get orders by tag?

Valery1
New Member
1 0 0

Can i get orders by specific tag via API? 
Do you have any ideas about it?

Thanks.

0 Likes
Jamie_D_
Shopify Staff (Retired)
Shopify Staff (Retired)
531 1 101

Hi Valery,

Unfortuantely this behaviour is not currently functional through the API. Sorry about that. Your best bet at this point would be to fetch of all the orders and then parse through them by tag.

Cheers,

Jamie

0 Likes
Lorraine_Woolf
Explorer
41 0 16

Please enable in the API

0 Likes
Lorraine_Woolf
Explorer
41 0 16

Dear Martin,

Thank you very much for this.

However, strictly speaking, the example you provided is NOT an API request.

An API request would look like this:

https://API_Key:Password@yourshop.myshopify.com/admin/orders/search.json?query=tag:blue

e.g.:
https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@yourshop.myshopify.com/adm...

Having tried that, it works!

How on earth did you figure that out?
There are so many things we want to do with the API, that simply aren't possible.

Do you perhaps know how to fetch the sales amount for the day, like it shows on the home page:

 

0 Likes
Robin24
Excursionist
22 0 5

Hi Lorraine,

What Martin provided is an API request. He's simply providing the URi, and the api key and secret would be sent in the HTTP headers and not in the URi string itself, but both will work (as you've found).

Most things are possible with the API. You need to grab all orders from 'today' using the API, and then sum up the total_price.

For example:

https://yourstore.myshopify.com/admin/orders.json?created_at_min=2016-09-10T12:00:00+01:00&api_key=1...

(^ this is another format that would work, when pasted into your browser).

That would show orders created after date 2016-09-10T12:00:00+01:00 as documented here.

So whatever application you're developing would generate today's date, make a request like above, and then iterate over the results adding up the total_price and then you have the data as shown in your screenshot.

If you wanted to be able to paste a command into a browser and get the total sales price for today, I very much doubt it will happen unfortunately :( However in shopifies defence, it would not be necessary for them to develop this feature as most people writing applications to use the API are happy to query and filter the orders api endpoint.

I hope you can find a way to get the data you need. You've got a great amount of sales by the way! If only... :)

Regards,

Robin

0 Likes
Lorraine_Woolf
Explorer
41 0 16

.Thanks Robin! 

This problem is still unresolved;

tags are NOT searchable using the API, despite what you've said. Here's why:

This works when logged in (authenticated) in the web browser:

https://API_Key:Password@yourshop.myshopify.com/admin/orders/search.json?query=tag:blue

But if you try that on a virgin browser (no cookies, no prior authentication), it fails:

{"errors":"Not Found"}

This is confirmed in this thread, which says tags are still not searchable:

https://ecommerce.shopify.com/c/shopify-apis-and-technology/t/shopify-api-gem-finding-order-based-on...
 

So basically, if I'm using my web-browser, I can use the API to search by tag.
But if I'm writing an application that uses the API, it does not work.

I stand by my assertion that this is unfortunately not possible with the API ;'(
Shopify sucks.

reyjyt765
New Member
4 0 0

Tags are helpful to reach on the right product. I'm also working on the Shopify store and I'm using the Tags of my related products and they are quite helpful for me.

0 Likes