Admin API/REST Reference - Is "Update a collection to remove its image" example correct?

pmd85
Tourist
21 0 1

Because why should I send full collection object in the request if I only want to remove its image? It doesn't make sense.

Here is link to reference  https://shopify.dev/docs/admin-api/rest/reference/products/customcollection#update-2021-04

 

Thanks

0 Likes
Kevin_A
Shopify Staff
Shopify Staff
311 42 54

Hey @pmd85 

Did you try the PUT to see if it functions as expected? From what I can tell it functions correctly as described, but if you notice a case where it doesn't, please provide us with an x-request-id response header so we can take a look. 

Kevin_A | 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

0 Likes
pmd85
Tourist
21 0 1

Yes, I tried and it works.

But why I should send a whole object(with all properties) to remove only the image? Why should I send published_at property when it is read only? Did you see the request body in the example? 

To remove collection image, It is enough to send id and image properties.

Please  correct/update reference. There are many similar errors/bugs in reference.

Example from reference:
PUT /admin/api/2021-04/custom_collections/841564295.json
{
"custom_collection": {
"id": 841564295,
"image": "",
"handle": "ipods",
"updated_at": "2021-04-01T17:56:52-04:00",
"published_at": "2008-02-01T19:00:00-05:00",
"sort_order": "manual",
"template_suffix": null,
"published_scope": "web",
"title": "IPods",
"body_html": "<p>The best selling ipod ever</p>",
"admin_graphql_api_id": "gid://shopify/Collection/841564295"
}
}
 
Minimal working(and logic) request body to remove image:
 
"custom_collection": {
"id":841564295,
"image": ""
}
}

 

Do you see the difference and the nonsense of the example?

Thanks

0 Likes