Development discussions around Shopify APIs
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 |
---|---|
10 | |
4 | |
3 | |
3 | |
3 |
As a business owner, have you ever wondered when your customer's first impression of yo...
By Skye Jun 6, 2023We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023