Update product variant sku by rest admin api

Hi all,

I’m trying to update sku for products variant using admin rest api.

this is api address i’m using:

https://mydomain/admin/api/2023-04/variants/40609745469533.json

and this is payload i’m passing in body:

{
“variant”: {
“id”: 40609745469533,
“sku”: “AAAXXX”
}
}

I would like change current sku value of this variant from “M65” to “AAAXXX”.

Postman test gives me no error and response status 200 OK, but variant sku doesn’t change.

May anyone help me?

Thanks in advance.

Hi SalvoP,

Could you try performing the same action but with a curl command rather than via Postman, to rule out that this is being caused by something on Postman’s side? eg:

curl -X PUT 'https://mydomain/admin/api/2023-04/variants/40609745469533.json' \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: your_access_token' \
-d '{
  "variant": {
    "id": 40609745469533,
    "sku": "AAAXXX"
  }
}'

This command should send a PUT request to the Shopify API to update the SKU of the specified variant of the connected store, and if it works then it would be worth looking at how auth is set up on Postmans side.

Hope this helps,

1 Like

Hi Liam,

Thank you so much for your answer.

Performing curl request works!

On postman, auth for get requests works fine. For curl request i’ve used same X-Shopify-Access-Token than postman.

So what can i chek for?

Are you making a PUT request on Postman, rather than a GET request?

i’ve made a put request to update variant sku.

Hi SalvoP,

If you’re still experiencing issues you may need to contact Partner Support who can take a deeper look into this call and any logs we can see on our end.

Thank you Liam,

The issue is only related to Postman.

code in my .net application works fine.