API Update Order Tag

Solved
Highlighted
New Member
4 0 0

Hello,

 

I've been trying to update an open order to include the tag imported via the rest API.

 

My API body matches the documentation exactly from what i can see however i seem to be getting a 400 response.

 

PUT  admin/api/2019-10/orders/186023031616.json

{ "order": { "id": 186023031616, "tags": "Imported" } }

 When executing the below i get the following response:

{
    "errors": {
        "order": "Required parameter missing or invalid"
    }
}

 

If there's any more information i can give to help find a resolution, let me know!

0 Likes
Shopify Staff
Shopify Staff
141 24 28

Hi @aaronroach ,

 

I was able to perform this exact same PUT request for my test store, and I can verify from my end that it worked correctly and my order was updated to have the new "Imported" tag. See the following screenshot: https://screenshot.click/19-11-3iw2p-w5nny.png

 

Perhaps your error may have come from a formatting issue. If you are still experiencing this same error, could you please provide me with the value of the "X-Request-ID" header from the API Response? With this value I can go through the logs on our end and see why this error may be occurring

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
New Member
4 0 0

Hi @hassain ,

 

Yeah, this seems like a very strange one, I cant seem to see any formatting errors, as what i copied above was exactly what i am sending (all be it with a different ID)

 

An example failure is X-Request-Id: 960bb787-aaec-4abe-979f-7d1bf926ee2e

 

Thanks for your help!

0 Likes
Shopify Staff
Shopify Staff
141 24 28

Hey @aaronroach ,

 

I was able to find your specific request with the 400 error response through the Shopify platform logs, but unfortunately I was unable to find any information that would indicate why the error was being thrown.

 

Could you verify you are passing the body of with the PUT request? Or using the correct API Access Token with your request? If you could provide a screenshot of the agent you are using to make the request (i.e. POSTMan, Insomnia, cURL) or provide the code that is generating the request, that could help. Thanks

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
New Member
4 0 0

Hi @hassain ,

 

I'm using VB.net to issue the request, however because i was experiencing the issue, i tried to debug it in Postman, however i'm getting the same issue. i'm passing a basic authorisation in the header, and presume its working as I'm not getting any authorisation errors. Using the same token method and auth, i am able to retrieve orders.

 

Its definitely being sent as a PUT as seen below:

 

error 400.png

 

 

0 Likes

Success.

Shopify Staff
Shopify Staff
141 24 28

Hey @aaronroach ,

 

In PostMan, change the type of the Body of your PUT request from "Text" to "JSON". Also make sure that the header of "Content-Type"="application/json" has been added to your request. That should resolve your issue.

 

Here are some screenshots that demonstrate what I am talking about: https://screenshot.click/19-11-hq463-6f0qm.png and https://screenshot.click/19-11-ulj4h-kndtk.png

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

1 Like
New Member
4 0 0

Hi @hassain ,

 

Thanks for this, I completely overlooked that, adding the content type solved it!

Thanks for your help in resolving this issue, and your prompt replies!

 

0 Likes