Updating Product Images via API

Solved
New Member
2 0 0

Hi there.

 

I'm doing some development for a Shopify account and one of the things i'm trying to achieve is to update the images by retrieving their links from Dropbox and then doing a PUT request to update the Product Object Images Array. As you’ll see this curl request returns an Image array with no objects. What is the correct way to supply the images? Is it possible to do this directly from a Dropbox link?

 

curl --request PUT \ --url https://naduvistore.myshopify.com/admin/products/4371926122584.json \
--header 'content-type: application/json' \
--header 'x-shopify-access-token: ACCESS_TOKEN' \
--cookie 'masterudr=eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWs0WW1GbVpHRmlNeTA0TkRJMExUUTVNemd0T1daaFpDMHpNR014T0RVMk9Ua3paR0lHT2daRlJnPT0iLCJleHAiOiIyMDIxLTA4LTA2VDE3OjEzOjU0LjAyN1oiLCJwdXIiOiJjb29raWUuX21hc3Rlcl91ZHIifX0%253D--db004ef4cc64c321f191e103f525d0a2408e25f1; _cfduid=dcace715f51636d90474f7cecd109d24b1559893369' \
--data '{
"product":
{
"images": [{
"src": "http://res.cloudinary.com/naduvi/image/fetch/fauto/https%3A%2F%2Fdl.dropboxusercontent.com%2Fs%2Flr7r3770lp40drd%2FTBL974311.jpg"
}, {
"src": "http://res.cloudinary.com/naduvi/image/fetch/fauto/https%3A%2F%2Fdl.dropboxusercontent.com%2Fs%2Fv2dhvzd96b1wqog%2FTBL97431_2.jpg"
}]
}
}'
0 Likes
Shopify Staff
Shopify Staff
349 49 56

Hey @yodarlabs,

 

Is it possible to do this directly from a Dropbox link?

It should be, assuming the URLs are public.

 

I was unable to access: 

http://res.cloudinary.com/naduvi/image/fetch/fauto/https%3A%2F%2Fdl.dropboxusercontent.com%2Fs%2Flr7r3770lp40drd%2FTBL974311.jpg

But this worked fine:

 https://dl.dropboxusercontent.com/s/lr7r3770lp40drd/TBL974311.jpg

 

Are you able to remove the Cloudinary part of the URL?

0 Likes
Highlighted
New Member
2 0 0

Hi @scottydont 

 

They were both accessible at the time. Even still I have tried with just that link but the object returned still contains no images.

0 Likes

Success.

Shopify Staff
Shopify Staff
349 49 56

Hey @yodarlabs,

 

Looks like the image is too big - I just tried and got the response:

 

The pixel limit is 20 megapixels. Resize your image and upload it again.
0 Likes