php-oauth icon indicating copy to clipboard operation
php-oauth copied to clipboard

Request for example of uploading image to Etsy

Open ipsod opened this issue 10 years ago • 8 comments

I've not used your package, but its predecessor. I was able to list an item on etsy, but failed to upload an image to an etsy listing. Would you please write an example of an etsy image upload?

ipsod avatar May 20 '15 23:05 ipsod

To save a time, post please details about Etsy image uploading.

logical-and avatar May 21 '15 05:05 logical-and

It's a bit of a pain to set up, since you (seemingly) first have to create a shipping template, then create a listing using that shipping template's id, then upload an image to the listing. Here's a link to Etsy's documentation:

ShippingTemplate https://www.etsy.com/developers/documentation/reference/shippingtemplate#method_createshippingtemplate

Listing https://www.etsy.com/developers/documentation/reference/listing#method_createlisting

ListingImage https://www.etsy.com/developers/documentation/reference/listingimage#section_uploading_images

Here's the array I used for creating a listing - could save you some keystrokes:

$fields = array(
        'quantity' => (integer) 1,
        'title' => 'Product',
        'state' => 'draft',
        'description' => 'Testing description.',
        'price' => (float) 42.42,
        'materials' => array('glass'),
        'shipping_template_id' => (integer) $shipping_template_id,
        //'shop_section_id' => null,
        //'is_customizable' => null,
        //'non_taxable' => null,

        //'image_ids' => null,
        //'image' => null,
        'processing_min' => 1,
        'processing_max' => 3,
        'category_id' => 68890894, // art and collectibles / glass art / sculptures and figurines
        'taxonomy_id' => 2889, // art and collectibles / glass art / sculptures and figurines
        'tags' => 'glass,marble,lampwork,bead', // validate using regex pattern: /[^\p{L}\p{Nd}\p{Zs}\-'™©®]/u 
        'who_made' => 'i_did',
        'is_supply' => (boolean) 0,
        'when_made' => '2010_2015',
        //'recipient' => null,
        //'occasion' => null,
        //'style' => null
);

ipsod avatar May 21 '15 17:05 ipsod

Thank you, I will see it soon

logical-and avatar May 26 '15 11:05 logical-and

Cool, thank you!

ipsod avatar Jun 04 '15 17:06 ipsod

Soon :)

logical-and avatar Jun 12 '15 20:06 logical-and

Thanks. But I am stuck with the same problem. What i did is: After creating shipping template and listing, for uploading image: $url = "https://openapi.etsy.com/v2/listings/".$this->listing['listing_id']."/images"; $i = str_replace($wp_dir['url'],$wp_dir['path'],$image); $data = [ '@image' => '@'.$i.';type='.$img_type['type'] ]; this gave me image path as : Array ( [@image] => @E:\xampp\htdocs\wordpress/wp-content/uploads/2018/01/cd_4_angle.jpg;type=image/jpeg )

also $url = "https://openapi.etsy.com/v2/listings/".$this->listing['listing_id']."/images"; $i = str_replace($wp_dir['url'],$wp_dir['path'],$image); $data = [ 'image' => '@'.$i.';type='.$img_type['type'] ]; this gave me image path as : Array ( [image] => @E:\xampp\htdocs\wordpress/wp-content/uploads/2018/01/cd_4_angle.jpg;type=image/jpeg ) and this too: $url = "https://openapi.etsy.com/v2/listings/".$this->listing['listing_id']."/images"; $i = str_replace($wp_dir['url'],$wp_dir['path'],$image); $data = [ 'image' => '@'.$i.';type='.$img_type['type'] ]; this gave me image path as : Array ( [image] => @http://localhost/wordpress/wp-content/uploads/2013/06/cd_6_angle.jpg;type=image/jpeg) But in none of the case image is uploading. Products lists are uploaded, but why my image are not uploading ? .I already saw the link above for uploading image in etsy api site. Could you please help me through this?

Tekrajs avatar Jan 07 '18 18:01 Tekrajs

Did anyone figure it out? I'm stuck on the same problem

ngr900 avatar Dec 04 '20 14:12 ngr900

The example for this in Etsy's documentation.

This worked for me, though: https://notestoself.dev/posts/etsy-api-php-oauth-listing-image-upload/

hughgrigg avatar Aug 13 '21 16:08 hughgrigg