Query meta fields for a specific order -- how?

samjones
Shopify Partner
7 0 0


We are looking at the docs RE meta fields:

http://docs.shopify.com/api/metafield

We do not see the answer to our question.

Our question is:

1) How do we query all metafields for a specific order?

2) How do we test if a specific order has any meta fields?

3) How do we request a single, specific, metafield for a specific order?

I should add, that we have tried everything we can think of, per the docs.

E.g.

/admin/orders/1060.json    // returns 404 error

/admin/order/1060.json    // dito

/admin/orders/1068/metafields.json  // ditto

We have tried for various orders, including ones where we can see metafields on the shopify order.

 

Thanks!

Replies 9 (9)
awd
Shopify Staff (Retired)
Shopify Staff (Retired)
83 0 9

Hello, can you provide the request id (its in the request headers) when you are attempting to retrieve a specific order (from your first example).

The end point is valid as per the Order documentation, but I want to understand further why you are seeing a 404 error in this case.

 

Adam Doeler, API Team, Developer at Shopify
samjones
Shopify Partner
7 0 0

Ack! Now I am confused!

What is the "request id" header?

In fiddler, I usually just do:

GET

<my store url>/admin/orders/1068/metafields.json

with these headers:

Content-Type: application/json
X-Shopify-Access-Token: #####
Host: ####.myshopify.com
Connection: Keep-Alive

 

The above works fine for many calls.

What am I missing? (RE 404 errrors?)

Also, I should note that the call above works.... to a degree. It does not return a 404. But it also does not return metafields I can see when I am logged in to the merchant console.

 

 

awd
Shopify Staff (Retired)
Shopify Staff (Retired)
83 0 9

Hello, the request id headers will be returned from our server upon your request. Using Fiddler, the request id would be in the web response.

 

 

Adam Doeler, API Team, Developer at Shopify
Rob_Curry
Shopify Partner
53 0 10

 

You can't use the order number ie #1060 you have to use the unique ID which you can see in the shopify admin. I think it's a 12 digit number.

 

samjones
Shopify Partner
7 0 0

Rob, Where do I see the unique id in the order payload?  (the payload returned by /admin/orders.json) ?

I am looking through it, and do not see a unique id 

 

Please advise!

 

samjones
Shopify Partner
7 0 0

Thanks!

Some 404's related to fetching an order:  /admin/orders/1063.json

X-Request-Id: ec6aa888-9cbf-4234-acb8-207d58d5fa14

X-Request-Id: d73d7fb3-8fea-4853-bc38-2b19ecc227ae

X-Request-Id: 20c56668-6de1-4de1-af20-3dd9e3cd5912

 

 

 

awd
Shopify Staff (Retired)
Shopify Staff (Retired)
83 0 9

An Orders unique ID is represented in the "id" property. Each Order will include this property and the value. 

The requests you've listed above are returning 404 because the Shop you are testing against does not have Orders with those IDs.

 

How are you determining the Order IDs for these requests?

Adam Doeler, API Team, Developer at Shopify
samjones
Shopify Partner
7 0 0

Thank you!

That was the issue. (id).  Solved!

awd
Shopify Staff (Retired)
Shopify Staff (Retired)
83 0 9

Awesome! 🙂

Adam Doeler, API Team, Developer at Shopify