Development discussions around Shopify APIs
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
This is the error I'm getting:
POST https://redacted.myshopify.com:443/admin/custom_collections.json
--> 422 Unprocessable Entity 88 (193.4ms)
Request:
{"custom_collection":{"title":"Redacted","collects":[{"product_id":9056559118},{"product_id":9065880270},{"product_id":8255843459},{"product_id":8255888707},{"product_id":8255943939},{"product_id":9056987470},{"product_id":9057523150}]}}
Headers: {"Authorization"=>"Basic YWVlYTAzNDJmNDljYzM1NTNlODU4MGQzMGE3YmY5Zjg6YzVlYzIwZGU3NDU5NTQ3MzRhNTQzZWI5N2RmODRiYmM=", "Content-Type"=>"application/json", "User-Agent"=>"ShopifyAPI/4.3.0 ActiveResource/4.1.0 Ruby/2.3.0"}
Response:
{"errors":{"collects.shop_id":["can't be blank"],"collects.product":["can't be blank"]}}
I can't find anything in the API Docs about needing to set a shop_id or a product when creating a custom collection. https://help.shopify.com/api/reference/customcollection
Anybody know what's wrong with my request?
Hey Kevin,
This is not an API related error rather an issue with the shop. I would recommend contacting the account owner of that shop.
- Jordan
Jordan | Developer Support @ Shopify
- Was my reply helpful? Click Like to let me 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
I am the account owner of the shop. Can you tell me how to resolve the issue?
For future reference. This was not an API related error, it was an issue of out of sync data. The product_id I was passing on the API request no longer existed in my store. In my case I was passing a couple hundred product_id's in on creation of the CustomCollection and only a few of them no longer existed. Took some debugging, but if you run into that error message, that's likely your problem.
This means there is a product id in the list of collects that does not exist in the shop anymore.
I wish the error was more clear and told you the product id that should be removed.
Throw the error saying these products dont exist and then list the ids.
Otherwise, the client has to go back and confirm each product id, find the one that does not exist and then resend the request. Sometimes that is 1000s of products in the collection.
User | RANK |
---|---|
5 | |
5 | |
4 | |
4 | |
4 |
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022