Jump to content

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

Api Lang Code Rate Topic   - - - - -

 

Posted 17 June 2016 - 02:59 PM #1

Hello,

 

i try to update via API one feature that is TEXT with this command

 

curl --user xxxx@XXXX.COM:xxxxxxxxxxxxxx --header 'Content-type: application/json' -X PUT 'http://TEST.com/api/products/8706'--data-binary '{"prod": {"feature_type": "T", "lang_code":"fr","value": "Feature updated"}}}'
 
in the variant lang_code i put "fr" but the feature update only in the "en" English language.
 
Can anyone help me with this?
 
 
 


 
  • The Tool
  • Been Here Way Too Long Member
  • Members
  • Join Date: 30-Mar 07
  • 3829 posts

Posted 17 June 2016 - 03:49 PM #2

The API isn't my strong point but shouldn't it be something like...

curl --user xxxx@XXXX.COM:xxxxxxxxxxxxxx --header 'Content-type: application/json' -X PUT 'http://TEST.com/api/products/8706'--data-binary {"product_features": {"id_#": {"feature_type": "T", "lang_code": "fr", "value": "Feature mis à jour"}}}


 

Posted 24 June 2016 - 01:46 PM #3

I think it was a bug in cs cart api and the lang_code doesn;t work.



 
  • ikoshkin
  • Tech Writer
  • CS-Cart Architects
  • Join Date: 25-Nov 15
  • 424 posts

Posted 27 June 2016 - 12:17 PM #4

Hello,
 
i try to update via API one feature that is TEXT with this command
 
curl --user xxxx@XXXX.COM:xxxxxxxxxxxxxx --header 'Content-type: application/json' -X PUT '

Hello,
 
The lang_code should be specified in the JSON of the product, rather than in the JSON of the feature. This cURL command should work:
 
curl --user xxxx@xxx.com:xxxxxxxxxxxxxx --header 'Content-type: application/json' --data-binary '{"lang_code": "fr", "product_features": {"25": {"feature_type": "T", "value": "Feature mis à jour"}}}' -X PUT 'http://localhost/api/products/12'

This command updates feature 25 of the product 2. Please keep in mind that if you have more features, you need to specify all of them when you update the product_features array — otherwise those features won't be specified for that product.

Please tell me if it helps.