eBay-Sell-Feed-API

Demonstrates how to upload a file to eBay and get the results using eBay's new Sell Feed API replacement for FileExchange.

To use this code in your PHP project, you only need two files:

application/libs/eBayRepository.php
application/conf/PHPConstants.php

<?php
$eBayRep = new eBayRepository(YourAuthorizationCode, YourRefreshToken);
$taskID = $eBayRep->sendToEbay('FileYouWantToUpload');
$json = $eBayRep->getResults($taskID);
?>

It can take some time for eBay to process your upload file, so you might want to call the last line above, getResults($taskID), repeatedly. These four eBay API calls are utilized by the repository class: createTask, uploadFile, getTask, and OAuth2/token

Notes

Many csv files that work fine on eBay's production environment will be marked 'Failed' in the sandbox environment. Don't waste time trying to debug import file structure in the sandbox. Make use of the action VerifyAdd to avoid accruing listing fees in the production environment.

eBay does not list csv files marked 'Failed' on the Upload History page in My eBay.

eBay API will often mark a file that contains an invalid category id as 'Failed' and offer no error message to explain why.

eBay's API documentation for uploadFile says to use option 'fileName' to specify the file you want to upload. This always gave me errors. I changed the option to 'file' and it started working.

In the production environment, you will get timed out if you make too many createTask calls in a short time period. If this happens, wait one hour before trying again. The timeout does not seem to apply to the sandbox environment.

Use Postman to help with debugging API calls. It will make your work much easier. It provides more helpful options than the API Explorer in eBay Developer tools.

Installation

To run the website:

Install curl on your webserver if not already installed. Ensure the project folder /public_html is browsable on your webserver. Set permissions on /public_html/export so your webserver can write to it. Set permissions in php.ini so the application can upload files. Edit the file PHPConstants. You only need to generate an authorization code once. Instructions can be found here. You will need to generate a refresh token about every 18 months. Instructions can be found here. Your values are specific to the eBay sandbox and the eBay production environments.

版权声明:

1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。
2、网站不提供资料下载,如需下载请到原作者页面进行下载。
3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考学习用!
4、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。