I've noticed that there seems to be quite a lack of information on how to get programmatic uploads and downloads working with File Exchange. I recently spent some time figuring this out, so I figured I'd share a few things in case other people someday need some basic instructions and examples of how to make it work.
I decided that the easiest way to do programmatic uploads and downloads is by using the program cURL, which is a free, text based web browser, which you can just invoke from a command line. This is similar to how the Java uploader works that eBay provided, but it's a lot easier due to the fact that you don't have to compile it first. It also works for programmatic downloads as well, so it's win / win. If you're using Windows, you can download cURL here:
All you have to do is unzip this folder, and stick it somewhere, such as in c:curl or wherever else you'd like it. If you're running a Linux computer, you can probably apt-get curl and get a working version for your distribution.
After cURL is installed, if you haven't already done so, you'll need to get a token to use. You can get a token by going here:
Click the "security token" link on that page. Sign into your account, give File Exchange permission to access your account, and you'll see your token in a text box on the following screen. Save the token somewhere safe.
Once you have cURL installed, and have a token, you're ready to go. Some things to be aware of are:
1: Whenever you submit your token, it needs to be URL encoded. You can easily do this with cURL.
2: The URLs shown on the above programmatic upload instructions link are 50% wrong. The upload URL is correct, however, the download URL is as follows: https:/
Lets start with doing an upload. You can execute the following command, and it will upload the file test.csv:
curl -k -o results.txt -F "token=**put your token here**" -F "email@example.com" https:/
--Please note that the discussion board turns the URL here into "Link". That URL just goes at the end of the string--
Just to explain things, the -k makes it ignore the fact that it can't verify who issued the SSL certificate. The -F command submits the token as "form data", which is required for the programmatic upload. So for this upload, we're submitting 2 pieces of form data: token + file. When you submit "form data" with cURL, it automatically URL encodes it, so we don't have to worry about that for the upload. The -o option makes it so that it outputs the results into a file called results.txt. If you omit the -o feature, it will just write the results to the screen.
When you execute that, it will upload test.csv, and will reply confirming that the upload was successful, and you'll be given a reference number. You can then use that reference number to programmatically download the result of that upload, once File Exchange has processed it.
Here is what you would execute to download the upload results of a file you uploaded:
curl -k -o uploadresult.csv --data-urlencode "token=**put your token here**" --data "jobId=334455667" https:/
This time we have to specifically tell cURL to URL encode the token, so we use the --data-urlencode command. You'll also notice that the second piece of data we're submitting is "jobId" *not* "refId". For downloading the upload results of something you uploaded, you must use "jobId". If you use "refId" your results download will fail. So the number for the jobId is the reference number that eBay replied back with to your upload you submitted with the first upload we submitted above.
Last of all, if you want to download your order files that are generated, then you would execute cURL like this:
curl -k -o orders.csv --data-urlencode "token=**put your token here**" --data "refId=5566778" https:/
This time you'll use "refId", and it will work for downloading any files that you would normally find in your File Exchange "Completed Downloads" area (like orders or paid and awaiting shipment files, etc).
Hope people find this information useful. Good luck, and have fun!