question

motorworksbmw avatar image
0 Likes"
motorworksbmw asked

Inventory API createOffer - how to escape forward slash in storeCategoryNames?

Hi When using createOffer or updateOffer how should forward slashes in storeCategoryNames be escaped? For example if the 'Shirts' category below was actually named 'Shirts/T-Shirts' how should the forward slash be escaped? I have tried 'Shirts/T-Shirts' but that didn't work. "storeCategoryNames": [ "/Fashion/Men/Shirts", "/Fashion/Men/Accessories" ], Thank you
inventory apinew sell apiescape
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

cute-otter avatar image
2 Likes"
cute-otter answered
You escape characters in JSON strings using the backslash. "\/Fashion\/Men\/Shirts" It is better to do it with code, if you are using PHP, try this: json_encode('/Fashion/Men/Shirts'); Note that it will also add the double quotes if it is a string. So if you are coming from an array $arr = ['/Fashion/Men/Shirts', '/Fashion/Men/Accessories']; "storeCategoryNames": '.json_encode($arr).'
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

motorworksbmw avatar image
0 Likes"
motorworksbmw answered
Backslash worked thank you. "storeCategoryNames": [ "/Fashion/Men/Shirts\/T-Shirts", "/Fashion/Men/Accessories" ],
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.