To continue receiving payouts, you need to secure your account by turning on two-step authentication. If two-step authentication is not turned on your payouts will be paused. Learn more

POST collects - 406 Not Acceptable error

Solved
CoppoG
Tourist
12 1 5

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

Accepted Solution (1)

Accepted Solutions
CoppoG
Tourist
12 1 5

This is an accepted solution.

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

My command call was wrong ...

Thanks to all

View solution in original post

Replies 3 (3)
2BDigital
Shopify Partner
175 43 55

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.

CoppoG
Tourist
12 1 5

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

CoppoG
Tourist
12 1 5

This is an accepted solution.

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

My command call was wrong ...

Thanks to all