When i do a put request using the WP API to the following endpoint i get an error (but only sometimes) and i can’t figure out what the issue is. Could it be a race-condition, caching issue (we’re using w3 cache) or something else?
This is the PUT request for a product that already exists:
https://fullhouse-wp.azurewebsites.net/wp-json/wc/v3/products/206177?consumer_key=xxx&consumer_secret=xxx
payload
{"images":
[{"src":"https://fullhouse-wp.azurewebsites.net/wp-content/uploads/product_images_sku/15839.jpg","position":0}]
}
which returns :
{
"code": "woocommerce_product_invalid_image_id",
"message": "#304582 er et ugyldigt billed-ID", // in danish this means #304582 is an invalid image-ID
"data": {
"status": 400
}
}
I have no clue where to start debugging since i can’t find woocommerce_product_invalid_image_id. We have a plugin called Upload Media By URL which takes the url and put’s the file into the “right” directory. The woocommerce version is 8.4.0.
The funny thing is that if you wait 10 minutes inbetween the PUT requests it works fint but if you run it consistently it returns the above error. Does anyone have a clue to what the issue could be or at least point me in the right direction?