Category Product remove doesn't work anymore
Since today I can't remove CategoryProduct via the API anymore, adding works but removal doesn't. I still got the response code 204 with no content as expected. Can anybody help ?
Post edited by SjoerdRutten on
9 comments
Hi @SjoerdRutten,
I was not able to reproduce the issue you are having.
Can you send the request you are making and the response you get so we can have a closer look.
Hi Ali,
after investigating further I found the problem is slightly different. When I get the product via the API I get a resource for categoryProduct:
array:1 [
"resource" => array:3 [
"id" => false
"url" => "categories/products?product=117527711"
"link" => "https://api.webshopapp.com/nl/categories/products.json?product=117527711"
]
]
when I get the 'categories - products' via the link given in de resource I get all the products, nog only the categories for the given product. So to find the categories for a specific product I have to retrieve all the records (in my case about 20750 records) to find the categories for this specific product. In the worst case scenario I have to make 83 API calls to find the right categoriesProduct id.
I may be wrong but this used to be different.
Hi @SjoerdRutten,
The link that is provided https://api.webshopapp.com/nl/categories/products.json?product=117527711" is giving you all the categories attached to the product. That is what you need right according to"So to find the categories for a specific product"?
Yes, it gives me all the categories attached to the product with all products attached to that categories! Product 117527711 is attached to 5 categories, but I get 20750 records back because I get every product attached to these 5 categories.
What do you mean with "with all products attached to that categories! "?
Product 117527711 is attached to 5 categories, but I get 20750 records back because I get every product attached to these 5 categories. What call are you making?
I make the call https://api.webshopapp.com/nl/categories/products.json?product=117527711 I expect to only get records for product 117527711 but I get a record for every product attached to the categories of product 117527711.
As example the first records of the response from the API call mentioned. As you can see all the products are different from the queried product
{
"categoriesProducts": [
{
"id": 833561411,
"sortOrder": 975,
"category": {
"resource": {
"id": 3231464,
"url": "categories\/3231464",
"link": "https:\/\/api.webshopapp.com\/nl\/categories\/3231464.json"
}
},
"product": {
"resource": {
"id": 117629189,
"url": "products\/117629189",
"link": "https:\/\/api.webshopapp.com\/nl\/products\/117629189.json"
}
}
},
{
"id": 833561410,
"sortOrder": 4350,
"category": {
"resource": {
"id": 2495502,
"url": "categories\/2495502",
"link": "https:\/\/api.webshopapp.com\/nl\/categories\/2495502.json"
}
},
"product": {
"resource": {
"id": 117629189,
"url": "products\/117629189",
"link": "https:\/\/api.webshopapp.com\/nl\/products\/117629189.json"
}
}
},
{
"id": 833556018,
"sortOrder": 976,
"category": {
"resource": {
"id": 3231464,
"url": "categories\/3231464",
"link": "https:\/\/api.webshopapp.com\/nl\/categories\/3231464.json"
}
},
"product": {
"resource": {
"id": 117628686,
"url": "products\/117628686",
"link": "https:\/\/api.webshopapp.com\/nl\/products\/117628686.json"
}
}
},
{
"id": 833556017,
"sortOrder": 4357,
"category": {
"resource": {
"id": 2495502,
"url": "categories\/2495502",
"link": "https:\/\/api.webshopapp.com\/nl\/categories\/2495502.json"
}
},
"product": {
"resource": {
"id": 117628686,
"url": "products\/117628686",
"link": "https:\/\/api.webshopapp.com\/nl\/products\/117628686.json"
}
}
},
Your shopID is 95054, right?
That's really weird, I tested it and was getting just the categories attached to the product, here's my response.
I think I got it. In Laravel I can't directly call the url with the querystring. I have to seperate the querystring. Thank you!
Okay perfect!