Hi,
I am trying to modify a python script that used a GraphQL query to retrieve data from monday via the API, that since the items-> item_pages transition stopped working.
I have used the playground and was able to generate updated query and get results per board and item, but when trying my script which does the same - just inside a loop the results come back empty.
And this is my code snippet that should do the same:
for item_id in item_ids:
# API query for item details
item_query = ‘’’
query {
boards(ids: %s) {
items_page(query_params:{ids: %s}) {
items {
id
name
column_values {
text
}
}
subitems {
name
column_values {
text
}
}
}
}
}
‘’’ % (board_id, item_id)
Thanks Matias, I corrected as you suggested and now get the subitems structure as part of the response. But this doesn’t solve my problem as the items still returns as “empty”.
This is an example of an empty item which I get now as the response:
query {
boards(ids: 6318008740) {
items_page(query_params:{ids: 6318008872}) {
items {
id
name
column_values {
text
}
}
subitems {
name
column_values {
text
}
}
}
}
}
That last query is still incorrect regarding the curly bracket. Here is the correct format:
{
boards(ids: 1234567890) {
items_page(query_params: {ids: 1122334455}) {
items {
id
name
column_values {
text
}
subitems {
name
column_values {
text
}
}
}
}
}
}
If you do not get any items in the response at all, it means that the combination of that board ID and that item ID does not exist, or that the user whose API token you are using does not have access to it.
Please check that the item ID is the ID of an ITEM and not of a SUBITEM.
Please also check that the user whose API token is being used for the query has access to that item.
The query itself (the one I send here) is correct.
Just in case, for a query like this one, where you are querying for the data in one item only, you don’t need the “boards”, or “items_page” parts. You can use something like this:
{
items(ids: 1122334455) {
id
name
column_values {
text
}
subitems {
name
column_values {
text
}
}
}
}
As I mentioned before, if you only need the data from one item, you can use something like this:
{
items(ids: 1122334455) {
id
name
column_values {
text
}
subitems {
name
column_values {
text
}
}
}
}
If you still want to use items_page for only one item (which is not necessary), you could add the ID of the specific item in the query_params like this:
{
boards(ids: 1234567890) {
items_page(limit: 100, query_params: {ids: 1122334455}) {
cursor
items {
id
name
}
}
}
}