Mimic Dashboard Orders Overview

I want to get all active/upcoming orders as listed in the dashboard (e.g. https://squareup.com/dashboard/orders/overview). Ideally, just “todays” orders.

I thought it would be something simple like…
"query": { "filter": { "state_filter": { "states": [ "OPEN" ] } }

But I seem to get all orders. The data returns seems to support them being OPEN (but they’re obviously closed, because they’'re not showing up in the dashboard). I’ve tried other queries with:
"fulfillment_filter": { "fulfillment_types": [ "PICKUP" ], "fulfillment_states": [ "PROPOSED" ],
No dice.

I even tried:
"date_time_filter": { "pickup_at": { "start_at": "2020-08-27T22:00:00:000Z", "end_at": "2020-08-27T23:99:99:999Z" } },
It didn’t throw an error, but didn’t work, either.

Anyway, I’m sure I’m missing something elementary, but I’d appreciate your help.

-Ryan

PS: Is there no post preview in this forum? Sorry, if it looks bad…

Hi @ryanlath welcome to the forums!

So, for the first query, it definitely works, and you only get open orders (I tested it), although it wouldn’t just be from today, if you have older OPEN orders. The last one doesn’t work because there is no “pickup_at” date filter (only closed_at, created_at, and updated_at). So there’s no real way to filter based on the pick up time, but you could also filter on the created time, something like:

{
  "location_ids": [
  	"{{location_id}}"
  	],
	"query": 
	{ 
		"filter": 
		{
			"state_filter": 
			{ 
				"states": [ "OPEN" ] 
			},
			"date_time_filter": {
				"created_at": {
					"start_at": "2020-08-27T22:00:00",
					"end_at": "2020-08-27T23:59:59"
				}
			}
		},
		"sort": {
			"sort_field": "CREATED_AT",
			"sort_order": "DESC"
		}
	} 
}

although you probably want to change the timezone by adding a “-/+” after the date. ex: “2020-08-27T22:00:00-08:00” for PST.

So this works in the sense that it returns data. Unfortunately, it’s not the data I want.

Is there really no way to use the api to get the data represented by:
https://squareup.com/dashboard/orders/overview

-Ryan

Apologies for misunderstanding. So, unfortunately not directly. The main missing component here is being able to filter for paid orders (for an order must be paid before it shows up in the dashboard). You can find open orders, with open/proposed/reserver fulfillments, but there’s no way to search explicitly for paid orders. So you could get close - but then would need to do some manual filtering and searching to see if they’ve been paid for (have a tenders object, and checking to see if the tenders is equal to the entire order object, else it would only be partially paid).