Getting 400 bad request REST admin API create custom collection

tristanherm
Tourist
9 0 0

Hi, 


I am trying to create a custom collection using the REST admin API and I am getting a 400 bad request when sending POST request to a dev store. I am developing on nodejs front end next js and backend koa js. Sending this request from the backend through public ngrok tunnel. 


Could use a little bit of help here since I cannot see whats going on from shopify's end. If there is a way to see logs from a dev store that could also work for me. 

Screen Shot 2019-12-08 at 1.19.20 AM.png

0 Likes
Visely-Team
Shopify Partner
1837 210 420

What do you have in your collection object you are sending with the POST?

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
0 Likes
tristanherm
Tourist
9 0 0
Sending image as data url
0 Likes
Visely-Team
Shopify Partner
1837 210 420

Would you elaborate a little? Can you share the code that creates the collection object from your code snippet above?

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
0 Likes
benjk
Excursionist
58 2 1

Was this ever solved as I am having a similar problem

0 Likes
sumitisrani88
New Member
1 0 0

Request:

curl -X POST \
https://amrendrabahubali.myshopify.com/admin/api/2020-04/custom_collections.json \
-H 'authorization: Basic YmNhN2U0Yzg5MmQzNTUwMjRkM2RmMjU3MjU1MTE5NTY6Y2FhZTE4YTM1NWQ2NDZmOTZkNjJlZmI2MzhlN2EwZTI=' \
-H 'cache-control: no-cache' \
-H 'postman-token: bc8eddae-36da-2acb-dfab-d385879ed989' \
-d '{
"custom_collection": {
"title": "custom_squadup"
}
}'

Response:
<html>
<body>
<noscript>
<a href="https://app.shopify.com/services/login/identity?destination_uuid=ae3dcf6f-9299-4771-a76a-5d515f479df...>
</noscript>
<script type="text/javascript" defer>
window.location = "https:\/\/app.shopify.com\/services\/login\/identity?destination_uuid=ae3dcf6f-9299-4771-a76a-5d515f479df7\u0026prompt=merge\u0026return_to=https%3A%2F%2Fapp.shopify.com%2Fservices%2Flogin%2Fidentity_callback%3Ffrom_signup%3Dfalse%26locale%3Den%26shop_name%3Damrendrabahubali%26state%3DfknBEa4vq9ZJ28rP-XeEspMfuBWrKB5K-iBH5Is5hgES7fQJJURYNWrTgDmdpWnmCsuOgXiXDIVWKcMf_aeic3Eur6JzbvCRQlMSyLNLwoC_FqDPsvw4m0DQY3yJzQr_xTj447DAQ8t9m8MvusmGrEXjJgRSVgmrcqoVsJzJNDlTciHcqHprPMxBaEKHrbmZAQP-epGOU6-_LIOFVHPv9k2MQY3WQpk7NS0JsGoZgl_luCKPWrEaUzT3CzErhOLm\u0026ui_locales=en\u0026ux=shop";
</script>
</body>
</html>

0 Likes
Greg_Kujawa
Shopify Partner
937 79 201

If you are using Postman then you need to delete/disable any cached cookies from being sent with your API request.

0 Likes