Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

POST custom_collections returning authorizatin url

POST custom_collections returning authorizatin url

louagej
Shopify Partner
3 0 0

Hi,

 

I'm trying to create a custom collection trough the 2023-01 version of the REST API:

https://{{api_key}}:{{api_password}}@{{store_name}}.myshopify.com/admin/api/{{api_version}}/custom_c...

The API returns a 200 OK status code, but inside the body there is an html page that point to 

Other api calls (products, metafields, ...) with the same api_key, api_password and store_name are passing without any issues.
 
The api has the correct roles for creating and updating collections: write_products, write_product_listings
 Below a screenshot of the response
louagej_0-1676315809027.png

 

Replies 3 (3)

ShopifyDevSup
Shopify Staff
1453 238 522

Hi @louagej 👋

 

To make valid authenticated requests, you will need to include your admin access token as a `X-Shopify-Access-Token` header on all Admin API requests. Below is an example of a valid authenticated request to create a custom collection:

 

curl -d '{"custom_collection":{"title":"test"}}' \
-X POST "https://STORE_NAME.myshopify.com/admin/api/2023-01/custom_collections.json" \
-H "X-Shopify-Access-Token: ACCESS_TOKEN" \
-H "Content-Type: application/json"

 

Hope that helps!

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

louagej
Shopify Partner
3 0 0

Hi @ShopifyDevSup ,

 

Thank you for your reply, but

other api calls (products, metafields, ...) with the same access_token runs without any issues.

 

louagej
Shopify Partner
3 0 0

Dear @ShopifyDevSup ,

 

Any other suggestions?

The header already contained the acces token.