louagej
1
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_collections.json
The API returns a 200 OK status code, but inside the body there is an html page that point to
https://accounts.shopify.com/oauth/authorize?...
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
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!
louagej
3
Hi @ShopifyDevSup ,
Thank you for your reply, but
other api calls (products, metafields, …) with the same access_token runs without any issues.
louagej
4
Dear @ShopifyDevSup ,
Any other suggestions?
The header already contained the acces token.