Product API fails when updating price

Product API fails when updating price

earokiasamy
Tourist
8 0 1

Hi All,

We are using the Product API to submit updates on prices. A few products fail to update the price and we get a "Not found" error back on the API call but the product does exist. The JSON input is below. Please let me know if you can help.

====================-JSON INPUT==============

{
"product_id": 6640355213487,
"title": "White / Large",
"sku": "50019L",
"position": 3,
"grams": 86,
"inventory_policy": "deny",
"fulfillment_service": "manual",
"inventory_item_id": 41711138504879,
"inventory_management": "shopify",
"price": 8.99,
"option1": "White",
"option2": "Large",
"option3": null,
"created_at": "2021-04-20T12:30:41-05:00",
"updated_at": "2021-05-05T20:18:05-05:00",
"taxable": true,
"tax_code": null,
"requires_shipping": true,
"barcode": null,
"inventory_quantity": 49,
"old_inventory_quantity": 49,
"inventory_quantity_adjustment": null,
"image_id": 29077697200303,
"weight": 0.1902,
"weight_unit": "lb",
"metafields": null,
"id": 39616960430255
}

====================JSON INPUT================

Replies 10 (10)

GrahamS
Shopify Staff (Retired)
193 37 55

Hello @earokiasamy ,

Can you provide an x-request-id for a call that resulted in a failure?

Best,

Graham

To learn more visit the Shopify Help Center or the Community Blog.

earokiasamy
Tourist
8 0 1

Hi Graham,

I'm not sure on where to find the x-request-id but is the Request and Response. Does this help?

REQUEST:

PUT https://raisingcanes.myshopify.com/admin/variants/6640354820271.json HTTP/1.1
X-Shopify-Access-Token:
Accept: application/json
Cookie: _y=670c54bb-6427-4be4-bf1a-a9c8782b1abc; _s=af559d25-9969-42fe-8fc9-9e3e37be0abf; _shopify_y=670c54bb-6427-4be4-bf1a-a9c8782b1abc; _shopify_s=af559d25-9969-42fe-8fc9-9e3e37be0abf
Content-Type: application/json
Content-Length: 530
Host: raisingcanes.myshopify.com

{"variant":{"product_id":6640354820271,"title":"Red / Large","sku":"50018L","position":3,"grams":86,"inventory_policy":"deny","fulfillment_service":"manual","inventory_item_id":41711132606639,"inventory_management":"shopify","price":8.9900,"option1":"Red","option2":"Large","created_at":"2021-04-20T12:30:30-05:00","updated_at":"2021-07-08T01:17:20-05:00","taxable":true,"requires_shipping":true,"inventory_quantity":29,"old_inventory_quantity":29,"image_id":29077690810543,"weight":0.1902,"weight_unit":"lb","id":39616956301487}}

 

RESPONSE:

HTTP/1.1 404 Not Found
Date: Wed, 04 Aug 2021 22:37:33 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Sorting-Hat-PodId: 174
X-Sorting-Hat-ShopId: 26406387748
Vary: Accept-Encoding
Referrer-Policy: origin-when-cross-origin
X-Frame-Options: DENY
X-ShopId: 26406387748
X-ShardId: 174
X-Stats-UserId:
X-Stats-ApiClientId: 3915305
X-Stats-ApiPermissionId: 208428498980
X-Shopify-API-Terms: By accessing or using the Shopify API you agree to the Shopify API License and Terms of Use at https://www.shopify.com/legal/api-terms
HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT: 1/40
X-Shopify-Shop-Api-Call-Limit: 1/40
X-Shopify-API-Version: 2020-10
Strict-Transport-Security: max-age=7889238
X-Shopify-Stage: production
Content-Security-Policy: default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval' https://* shopify-pos://*; block-all-mixed-content; child-src 'self' https://* shopify-pos://*; connect-src 'self' wss://* https://*; frame-ancestors 'none'; img-src 'self' data: blob: https:; script-src https://cdn.shopify.com https://cdn.shopifycdn.net https://checkout.shopifycs.com https://api.stripe.com https://mpsnare.iesnare.com https://appcenter.intuit.com https://www.paypal.com https://js.braintreegateway.com https://c.paypal.com https://maps.googleapis.com https://www.google-analytics.com https://v.shopify.com https://widget.intercom.io https://js.intercomcdn.com 'self' 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests; report-uri /csp-report?source%5Baction%5D=update&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fproduct_variants&source%5Bsection%5D=admin_api&source%5Buuid%5D=89065436-9207-4572-959d-b6b6e09e4ae6
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block; report=/xss-report?source%5Baction%5D=update&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fproduct_variants&source%5Bsection%5D=admin_api&source%5Buuid%5D=89065436-9207-4572-959d-b6b6e09e4ae6
X-Dc: gcp-us-east1,gcp-us-central1,gcp-us-central1
X-Request-ID: 89065436-9207-4572-959d-b6b6e09e4ae6
Set-Cookie: _y=670c54bb-6427-4be4-bf1a-a9c8782b1abc; Expires=Thu, 04-Aug-22 22:37:33 GMT; Domain=raisingcanes.myshopify.com; Path=/; SameSite=Lax
Set-Cookie: _s=af559d25-9969-42fe-8fc9-9e3e37be0abf; Expires=Wed, 04-Aug-21 23:07:33 GMT; Domain=raisingcanes.myshopify.com; Path=/; SameSite=Lax
Set-Cookie: _shopify_y=670c54bb-6427-4be4-bf1a-a9c8782b1abc; Expires=Thu, 04-Aug-22 22:37:33 GMT; Domain=raisingcanes.myshopify.com; Path=/; SameSite=Lax
Set-Cookie: _shopify_s=af559d25-9969-42fe-8fc9-9e3e37be0abf; Expires=Wed, 04-Aug-21 23:07:33 GMT; Domain=raisingcanes.myshopify.com; Path=/; SameSite=Lax
CF-Cache-Status: DYNAMIC
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 679b455a9b325e8a-IAD
alt-svc: h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; ma=86400

16
{"errors":"Not Found"}
0

GrahamS
Shopify Staff (Retired)
193 37 55

I ran a check on the x-request-id you provided, (for future reference, it's in the response headers you provided, 2/3rds way down). The JSON contents for this request appear to be for a different product than the one outlined in your original post, but same overall issue. The problem lies with the very first line of your request.

Currently, you're offering the following input: PUT "/admin/variants/{product_id}.json instead of PUT "/admin/variants/{variant_id}.json

The variants endpoint expects a variant ID to be cited in the call URL rather than the product ID associated with that variant. Because of this, you'll get a 404 since there are no variants in the shop that match the ID provided. I can't offer too much information on why this would be happening with these specific products, but I cansay that the issue should be resolved if the variant IDs supplied during the call are updated to match their admin values.

Best,

Graham

To learn more visit the Shopify Help Center or the Community Blog.

earokiasamy
Tourist
8 0 1

Thanks Graham! We will try this now.

earokiasamy
Tourist
8 0 1

Hi Graham,

Now, we're getting the following error. New x-request-id: 880263cd-a9e2-4d9b-a77c-de29c3756ae5

{"error":"Write requests to inventory_quantity and inventory_quantity_adjustment are no longer supported. Please use the Inventory Levels API."}

We are not updating the quantity, we need to update the price. 

 

Thanks,
Eugene.

GrahamS
Shopify Staff (Retired)
193 37 55

Hello @earokiasamy ,

Can you provide some additional context regarding that x-request-id? I ran a search on it going back 72 hours but there were no hits. Do you know specifically when that request was run?

To learn more visit the Shopify Help Center or the Community Blog.

earokiasamy
Tourist
8 0 1

Hi Graham,

We did another post and here's the ID.

X-Request-ID: bcae1984-b60e-4c41-9fe8-1bed9dd73bf0

I have also attached the Response.

 

Thanks,
Eugene.

earokiasamy
Tourist
8 0 1

Hi Graham,

Touching base on this to see if there's anything else we can try.

Thanks,
Eugene.

earokiasamy
Tourist
8 0 1

Anyone that can help with this?

GrahamS
Shopify Staff (Retired)
193 37 55

Hello @earokiasamy ,

Apologies for the late response! The x-request-id didn't shed too much light on this one. Can I ask that you DM me the full request being made, including the endpoint URL being used? It looks like a deprecation error, but it's hard to tell initially without knowing the payload contents.

To learn more visit the Shopify Help Center or the Community Blog.