API Issue - Python Read

We were issuing very standard read queries and they were working, but then mysteriously stopped working with the error:

“undefinedField” message:

“Field ‘items’ doesn’t exist on type ‘Board’”

This exact file executed earlier, but now fails.

This is what we were running:

import requests

apiKey = redacted
apiUrl = "https://api.monday.com/v2"
headers = {"Authorization" : apiKey,
           "api-version": "2023-10",
           "user-agent": "Make/production"
           }

query = """{
  boards (ids: 5971617342) {
    items {
      id
      name
      column_values {
        id
        title
        value
      }
    }
  }}"""

data = {'query' : query}

r = requests.post(url=apiUrl, json=data, headers=headers) # make request

board = r.json()

for item in board['data']['boards'][0]['items']:
    id = int(item['id'])
    name = item['name']

Has anyone experienced this issue, and would you mind sharing how you resolved it?

hi @bleong

Welcome to the community. This is one of the braking changes from API version to 2023-07 to 2023-10. The field items is not available on boards, you need to nest items in an items_page object.

See Migration guide - 2023-10

I’m not a Python expert, but you code should be something like

query = """{
  boards (ids: 5971617342) {
   items_page (limit:100) {
    cursor
    items {
      id
      name
      column_values {
        id
        title
        value
      }
    }
   }
  }}"""

You will get the first 100 items on the board. As long the returned cursor is not null you can retrieve the next 100 items with

query {
  next_items_page (limit: 100, cursor: "the cursor you got returned") {
    cursor
    items {
      id
    }
  }
}