API /custom_types does not return the status option GID

When calling the /custom_types API endpoint

curl --request GET
–url ‘https://app.asana.com/api/1.0/custom_types?opt_fields=name,status_options,status_options.name,status_options.color,status_options.completion_state,status_options.enabled&project=
–header ‘accept: application/json’
–header ‘authorization: Bearer ’

The response contains “gid”: “undefined” for each of the status options.
To be able to programatically access and define custom types, we need a source for the GIDs

To that end, I’m also looking forward to seeing Global Custom Types so that one GID reference can be applied across all projects.

Example dataset result, with all status option gids as undefined.

{
“data”: [
{
“gid”: “1209633253410919”,
“name”: “Custom Status”,
“status_options”: [
{
“gid”: “undefined”,
“name”: “:hollow_red_circle:Not Started”,
“enabled”: true,
“color”: “none”,
“completion_state”: “Incomplete”
},
{
“gid”: “undefined”,
“name”: “:white_check_mark:Completed”,
“enabled”: true,
“color”: “none”,
“completion_state”: “Complete”
},
{
“gid”: “undefined”,
“name”: “Not Started”,
“enabled”: false,
“color”: “pink”,
“completion_state”: “Incomplete”
},
{
“gid”: “undefined”,
“name”: “Waiting”,
“enabled”: false,
“color”: “aqua”,
“completion_state”: “Incomplete”
},
{
“gid”: “undefined”,
“name”: “:pause_button:Waiting”,
“enabled”: true,
“color”: “aqua”,
“completion_state”: “Incomplete”
},
{
“gid”: “undefined”,
“name”: “:counterclockwise_arrows_button:In Progress”,
“enabled”: true,
“color”: “none”,
“completion_state”: “Incomplete”
},
{
“gid”: “undefined”,
“name”: “Post Event Follow u”,
“enabled”: false,
“color”: “orange”,
“completion_state”: “Incomplete”
},
{
“gid”: “undefined”,
“name”: “:right_arrow:Post Event Task”,
“enabled”: false,
“color”: “blue”,
“completion_state”: “Incomplete”
},
{
“gid”: “undefined”,
“name”: “:right_arrow_curving_down:Post event task”,
“enabled”: true,
“color”: “orange”,
“completion_state”: “Incomplete”
},

Hi @Tristan_Blackburn and welcome to the forum,

(FYI I moved your post to the English Forum > Developers & API forum section which is for all developer-related and API questions.)

You have to include status_options.gid in your opt_fields list and that will get you the gids.

It’s a little odd IMO because I’m not aware of any other objects in the API where that’s the case, but it’s what’s required here.

3 Likes

Interesting. Thanks @Phil_Seeman - certainly a different behaviour to other API objects and to the extent where status_options.gid isn’t present in the reference documentation Get all custom types associated with an object
I can confirm though that your solution is correct.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.