Using Curl with Xojo (Real Basic) to Upload a File
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2020 01:21 PM
Hi
I am writing a Mac desktop app to manage my eBay inventory . I have started coding an upload procedure using CURL to upload a file with a POST into the File Exchange system.
When I run my code I get this response
<html>
<head>
<!--eBay V3- msxml 6.0 XXXXXXXXXXXXXXXXXXXXXXXXXX-->
<!--srcId - File Exchange Programmatically Upload-->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>Upload File Programmatically</title><script language="JavaScript"><!--
var pageName = "File Exchange Upload";
//--></script><script language="javascript" src="http://include.ebaystatic.com/js/e1065/us/legacy/globals_e10651us.js"> </script><script src="http://include.ebaystatic.com/js/e1169/us/legacy/common_functions_e11692us.js"> </script></head>
<body>
File upload successful. Your ref # is .<br><a href="javascript:void(0);" onclick="self.close();return false;">Close</a></body>
</html>
Which looks promising as it says file upload successful, but when I go to my File Exchange/View Upload results page, there is no file there.
Please ca anyone help?
Here is my Xojo (RealBasic Code). It uses a commercial Curl library (MonkeyBread Software)
dim e as integer
dim d as new UploadCURL
var Token as String
Var FileName as String
Var fi as FolderItem
fi = SpecialFolder.UserHome.Child("MMS").Child("Uploads").Child("EBUK").Child("Test16.csv")
FileName = fi.NativePath
Token = "My Secret Token"
d.OptionURL = "https://bulksell.ebay.com/ws/ebayISAPI.dll?FileExchangeUpload"
d.OptionVerbose = True
d.CollectOutputData = true
d.FormAddField("token", Token)
d.FormAddField("file", "filename=" + FileName, "text/csv")
d.FormFinish
e=d.Perform
'this bit just displays the results
ListBox1.AddRow "Result: "+str(e)
ListBox1.AddRow d.GetInfoContentType
Result.text = ReplaceLineEndings(d.OutputData,EndOfLine)
Thanks Mark
Using Curl with Xojo (Real Basic) to Upload a File
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2020 07:41 PM
I'm not at all familiar with your programming language, but I don't see a ref# in the response file, as if the eBay script failed to run. Was the number missing or did you remove it from the post?
Have you manually uploaded a single-record CSV file to File Exchange to verify your CSV data structure is correct? One of the simplest files you can upload is a revision file for a single record with some minor change, like price. I would recommend something that simple when debugging an external program in order to exclude any issues with the file itself.
Action,ItemID,StartPrice
Revise,############,12.95
Additionally, there may be line-end issues with Mac spreadsheet data, so the CSV should be saved in DOS format. The CSV file should not include any leading BOM characters for UTF-8.
Using Curl with Xojo (Real Basic) to Upload a File
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2020 05:07 AM
@shipscript is correct. This is a line end issue. Examine 'd.OutputData,EndOfLine' . It should be carriage return,linefeed. Default Mac EndOfLine is just carriage return. eBay expects MS-DOS line endings. Since the language you are using is compiled for Mac, I suspect that the above field is incorrect, and eBay is just throwing out the file that you are uploading (even though the file is uploading successfully).
I have used cURL for years to upload files. I get the same response as you do, with the exception that I receive the ref number.
