Focusing on managing products, variants, and collections through the 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:
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.
Solved! Go to the solution
This is an accepted solution.
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,
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
This is an accepted solution.
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,
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
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?
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
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.
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Thank you Liam,
The issue is only related to Postman.
code in my .net application works fine.