How to query the current value of a status of an item

Im trying to use the API (GraphQL) to just call the current status of a column of an Item. So for example I call the item ID and then find out the current value of a status column (working on it, Done, ect.).

Hello @familyindustries and welcome to the Monday.com community!

How are you currently accessing the API? If you are using Python, you can easily perform this action using the Moncli package using the following code.

from moncli import client

client.api_key_v2 = 'API_KEY'
item = client.get_items(ids=[item_ids], get_column_values=True)[0]
status_label = item.column_values['COLUMN_VALUE_ID_OR_TITLE'].text

If this solutions works for you, you may download the package using the following command below.

$ pip install moncli

Thank you, and I wish you all the best,

Andrew

Thank you! Im actually using the GraphQL

I would like to just call the Item ID and then name the column and have the API tell me the current value

hi @familyindustries , Alex

Welcome to the community. What about this GraphQL

{
  items(ids: 123456789) {
    column_values(ids: "status") {
      id
      value
      text
    }
  }
}

it returns:

{
  "data": {
    "items": [
      {
        "column_values": [
          {
            "id": "status",
            "value": "{\"index\":0,\"post_id\":null,\"changed_at\":\"2021-03-21T18:12:29.826Z\"}",
            "text": "Working on it"
          }
        ]
      }
    ]
  },
  "account_id": 123456
}

The value shows you the index only, you would need to query the column setting_str to correlate the index with the textual value. The text property shows the actual text of the selected status.

Thank you!

That worked! I did not have the “text” in my code. This is a big help. Thank you!

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