inakiabt / etsy-php

Etsy API wrapper for PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create Product Listing

ravigondaliya opened this issue · comments

Hi,

i Download your code and try to post product on etsy marketplace but i got an error

Fatal error: Uncaught Etsy\EtsyRequestException: [1]: Invalid auth/bad request (got a 400, expected HTTP/1.1 20X or a redirect): Array ( [quantity] => 1 [title] => This is a Second [description] => This is a Second. [price] => 6.99 [state] => active [shipping_template_id] => 41335773035 [shop_section_id] => 18026382 [tags] => Array ( [0] => color ) [who_made] => i_did [is_supply] => [when_made] => 1960s ) Invalid value for boolean.Array ( [http_code] => 400 [content_type] => text/plain;charset=UTF-8 [url] => https://openapi.etsy.com/v2/private/listings?oauth_consumer_key=6pdyciuv2kfmkfj8tvkb1ioa&oauth_signature_method=HMAC-SHA1&oauth_nonce=1114058eb60a5369b65.97527369&oauth_timestamp=1491820709&oauth_version=1.0&oauth_token=6ecb38f3827649a44a1412cc3c8989&oauth_signature=YUf9yFoR3rSILq07FpcaxS%2BDkUI%3D [header_size] => 767 [request_size] => 640 [filetime] => -1 [ssl_verify_result] => 20 [redirect_count] => 0 [tota in D:\xampp\htdocs\etsy-php-master\src\Etsy\EtsyClient.php on line 65

My Code
$client = new Etsy\EtsyClient($auth['consumer_key'], $auth['consumer_secret']);
$client->authorize($auth['access_token'], $auth['access_token_secret']);
$api = new Etsy\EtsyApi($client);
$new_listing = array(
'data' => array(
'quantity' => 1,
'title' => 'This is a Second',
'description' => 'This is a Second.',
'price' => 6.99,
'state' => 'active',
'shipping_template_id'=> 41335773035,
'shop_section_id' => 18026382,
'tags' => array("color"),
'who_made' => 'i_did',
'is_supply' => false,
'when_made' => '1960s',

)

);

$new_listing_response = $api->createListing($new_listing);
echo "

"; print_r($new_listing_response);exit;

if you have any solution please help me.

I could reproduce it. There's something wrong with false boolean data params.
I'll take a look later.

Any update on this? A listing can only be created with is_supply value of true

Any update on this? A listing can only be created with is_supply value of true

This is actually the problem, how can we fix it ?