I'm trying to add an image along with a new listing to my Etsy account through a web application that I'm developing. Currently, I am using:
RestRequest request = new RestRequest("listings", Method.POST);
request.AddFile("image", ReadToEnd(o.mainPhoto), "test.bmp", "image/bmp");
request.AddParameter("image", "test.bmp");
request.AddParameter("title", "This is a test");
request.AddParameter("description", "Test Description");
request.AddParameter("status", "draft");
request.AddParameter("quantity", "1");
request.AddParameter("price", "5");
request.AddParameter("is_supply", "false");
request.AddParameter("category_id", "68887420");
request.AddParameter("when_made", "2013");
request.AddParameter("who_made", "i_did");
request.AddParameter("shipping_template_id", 5463224);
var etsyResponse = restClient.Execute<EtsyListing>(request);
The listing is created correctly except there is no image.
I noticed that the etsyResponse has content containing information regarding the image uploaded (i.e. size, name, etc..) including a "tmp_name" created for the image. Should I be associating the listing with the "tmp_name" from the etsyResponse instead of the uploaded name of the file?
Any help is appreciated.
I actually just had the exact same problem. I'm using a C# server side handler with RestSharp POSTing a new listing with image data from an HttpPostedFile instance. The draft listings were created just fine, but without any image. Like you mentioned, I saw the tmp_name and errors values which seemed to suggest the image was created. After experimenting, my final solution which has worked just fine is to:
Hope this helps.