How to get all task statused in one query

Hi all,
I am trying to get all statuses used on my side so I can use their name (i.e.human readable label") to repolace the status code I get via my usual queries.
E.g. “act” > “actve”, “cfrm” > “confirmed” etc.
When I go to my admin menu’s “Status List” page I see all of those, whoever, the api only seems to allow for querying one entity at a time, e.g.:

How can I get all statuses as shown on the Status List page in one quick swoop?
Or is it possible to get the human readable value directly in a shot or task query?

Currently I am using two calls like this:

task_status_list = self.CONNECT.schema_field_read("Task","sg_status_list")["sg_status_list"]["properties"]["display_values"]["value"]
shot_status_list = self.CONNECT.schema_field_read("Shot","sg_status_list")["sg_status_list"]["properties"]["display_values"]["value"]
status_list = {**task_status_list, **shot_status_list}


You can just query the statusses like anything else as they are an entity too.

filters = [["code", "is", "ip"]]
fields = ["name"]
print(shotgun.find_one("Status", filters, fields))


{'type': 'Status', 'id': 9, 'name': 'In Progress'}

Ah yes, of course, thanks @Ricardo_Musch
I had gone down the rabbit hole.

1 Like

We all do sometimes :smiley:

Actually, if you enter something invalid in to the shotgun.find("invalid", filters, fields) method you get an error with the list of entities that you can query from :slight_smile:

yeah, gotta love the old “break it to fix it approach”.
i.e. stab it to see what colour it’s blood is :smiley: