Add Categories In Api

Is it possible to assign categories to a product using the api? I tried this:



curl --user admin@example.com:pass --header 'Content-Type: application/json' -d '{"category_ids": "[1108,1109,4]"}' -X PUT 'http://www.example.com/api/stores/1/products/5536'




But got this response:



{“message”:“Bad Request: Product must belong to some category created by the owner company.”,“status”:400}

it means that at least one of these categories do not belong to the same company as product belongs

in your example you use store with company_id = 1 so all these categories should belong to the same company with ID #1



best regards,

WSA team

Try to split the request into 3 (separate for each category) and check each to find the problem