POST collects - 406 Not Acceptable error

Solved
Highlighted
Tourist
8 1 2

Hi,
When I try to add a product to a custom collection, I get the error code 406.

My command call is
POST https: //.......myshopify.com/admin/api/2020-07/collects.json

With this JSON
{'collect': {'product_id': myProduct_id, 'collection_id': myCustomCollection_id}}

Both myProduct_id and myCustomCollection_id correspond to real and correctly created entities.
Anyone know why?

Thanks

1 Like
Highlighted
Excursionist
80 19 19

Hi

Do you have the correct permissions against those API keys?

Can you also show us the code that you're actually using to make the call?

406 Error normally means there's some kind of error in the way the request is formatted.

0 Likes
Highlighted
Tourist
8 1 2

This is my APP level permission for PRODUCT

Product

View or manage product, variants and collections

Access indicators: read_products, write_products

Read and write

 

I've read this on DOCS the sintax for this call.

https://shopify.dev/docs/admin-api/rest/reference/products/collect#create-2020-07

POST/admin/api/2020-07/collects.json
Adds a product to a custom collection.
 
Create a new link between an existing product and an existing collection
POST /admin/api/2020-07/collects.json
{
  "collect": {
    "product_id": 921728736,
    "collection_id": 841564295
  }
}

This is exactly what I write when I make the API call

0 Likes
Highlighted
Tourist
8 1 2

This is an accepted solution.

I've whatch better my command call in debug mode...

My command call was wrong ...

Thanks to all

0 Likes