Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Api Access To Update Gtin Rate Topic   - - - - -

 

Posted 07 January 2016 - 08:35 PM #1

I've trying to update the GTIN for all the products.

 

The api URL is /api/products/45/features/2

 

Where 45 is the first product ID to update and 2 is the feature id of GTIN (according to a JSON dump)

 

If I set the GTIN in the GUI to say xxx and run the script to update it to a proper value, xxx is deleted and GTIN is set to a blank.  I can't get the PUT to work even though the same code with a different URL will happily update the stock amount.  The HTTP Response is 200 so it claims to have worked but it's not writing the value I want.

 

Any suggestions?

 

 



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11248 posts

Posted 07 January 2016 - 11:14 PM #2

Use an import rather than the api.  Only assuming that this is a one time (or infrequent) update.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 

Posted 08 January 2016 - 07:18 AM #3

It is only a one off, but I need to apply logic to match the EAN to the product so an import won't do it.

 



 

Posted 08 January 2016 - 10:53 AM #4

I've done a bit more investigation.
 
if I use CURL to get the product json:
curl --user api@example.com:xxx -X GET http://www.example.c...pi/products/45/

I get, amongst other thing this:

"product_features":{"2":{"feature_id":"2","value":"xxxx","value_int":null,"variant_id":"0","feature_type":"T","description":"GTIN","prefix":"","suffix":"","variant":null,"parent_id":"1"}

Which seems right as I currently have xxxx as the GTIN value.

If I add the features url:
curl --user api@example.com:xxx -X GET http://www.example.c...s/45/features/2

I get back:

{"feature_id":"2","feature_code":"","company_id":"0","feature_type":"T","parent_id":"1","display_on_product":"0","display_on_catalog":"0","display_on_header":"N","description":"GTIN","lang_code":"en","prefix":"","suffix":"","categories_path":"","full_description":"","status":"A","comparison":"N","position":"0","variants":[]}

Which is missing the value key.

is this right or is it a bug? If it's a bug it may explain why my updates are being ignored.

Edit

This is a bug.  If I use CURL to update another field like full_description it works, it's just the value field it fails on.