inakiabt / etsy-php

Etsy API wrapper for PHP
74 stars 59 forks source link

creatingListing passes empty params #19

Closed xiaEngineer closed 7 years ago

xiaEngineer commented 7 years ago

When creatingListing the EtsyApi call internally prepareParameters() and return empty $params. Which leads to incorrect request and no params is passed to the request.

inakiabt commented 7 years ago

Do you have example code to reproduce the issue?

xiaEngineer commented 7 years ago

Here is the data i am sending. $tmpl_id = '41269799259'; $args = array( 'data' => array( "quantity" => 1, "title" => "10KT White Gold 1.75ctw Amethyst & Diamond Cocktail Ring, 11.44gm. Size: 5.25", "description" => "This brightly polished 10KT white gold ring contains one amethyst in the center, surrounded by single cut diamonds, all prong set in a raised basket style setting. A twisted rope design finishes the look, all set atop a five layer shank.", "price" => 720.00, //"materials" => array('wood, plastic'), 'shipping_template_id'=>$tmpl_id, //"shop_section_id" => 123456, //"image_ids" => array(1), // Multimple? //"non_taxable" => false, "state" => "draft", //"processing_min" => 123456, //"processing_max" => 123456, "category_id" => 2115, //"tags" => array('fashion, othertag'), "who_made" => "someone_else", 'is_supply' => true, "when_made" => "1980s", //"recipient" => "men", //"occasion" => "baptism", //"style" => array('style1, style2') ) );

$result = $api->createListing($args);
inakiabt commented 7 years ago

I tried your example code and I found two things: 1- shipping_template_id must be an integer, so your code should fail with

PHP Fatal error:  Uncaught exception 'Exception' with message 'Invalid params for method "createListing": Invalid data param type "shipping_template_id" (41269799259: string): required type "int"

2- If I use an integer for shipping_template_id I get a different error:

object has validation errors on the following field(s): listing_id (listing_id can't be empty)

(this error is from Etsy's API, not a local validation error)

BUT if I remove the category_id argument it works. I couldn't find documentation about this. Maybe they changed something on the API side.

What's the error you're getting?

inakiabt commented 7 years ago

I found this: https://groups.google.com/forum/#!topic/etsy-api-v2/8VUv3biV19w Seems like others are having issues when creating listings with category_id included (since april 4th at least).

inakiabt commented 7 years ago

I also found that adding a taxonomy_id argument it works. But taxonomy_id on createListing isn't supported in the actual lib version (0.9.4). I'm pushing a new version adding support to the latest API schema.

inakiabt commented 7 years ago

Done: 0.10.0

xiaEngineer commented 7 years ago

Great thank you. I am testing it right away.

inakiabt commented 7 years ago

A word from Etsy about this: https://groups.google.com/d/msg/etsy-api-v2/8VUv3biV19w/0rwDYg4VAwAJ

Closing this issue.