I tried to upload images as URL on new products with REST API, but the error reads “404 Not Found”.
Although I can upload images on products existing images, I cannot do first image on them.
I am using Python and REST API, and writing code like the below
import shopify
import requests
SHOP_URL = "https://example.myshopify.com"
API_SECRET ="password"
product = shopify.Product()
product_id = product.variants[0].id
endpoint = f'{SHOP_URL}/admin/api/2021-07/products/{product_id}.json'
headers = {
"Content-Type": "application/json",
"X-Shopify-Access-Token": API_SECRET,
}
src="https://example.com/jpg"
image = {
"product": {
"images": [
{"src": src}
]}
}
r = requests.put(endpoint, headers=headers, image)
print(r)
<Response [404]>
Please tell me why