Skip to main content

Thanks to some great help here, I can get all the data in my board with the following query…


query {
boards (ids: :123456789]) {
items_page (limit: 50) {
cursor
items {
id
name
column_values {
id
text
value
column {
id
type
title
settings_str
}
}
}
}
}
}

The data that comes back look like this…


{
"data": {
"boards": s
{
"items_page": {
"cursor": "some-long-string-of-chars",
"items": s
{
"id": "987654321",
"name": "Company name",
"column_values": s
{
"id": "subitems__1",
"text": null,
"value": "{}",
"column": {
"id": "subitems__1",
"type": "subtasks",
"title": "Subitems",
"settings_str": "..."
}
}
]
}
// more items here
]
}
}
]
}
}

As you can see, the second property for each item is "name", which in my case contains the name of the company.


I now want to get the same data, but just for a single company. I found the following code in another post here


query {
items(ids: 123456789) {
column_values {
id
value
type
text
column {
title
}
}
}
}

However, whilst this returns most of the data for the item, it misses out the name…


{
"data": {
"items": i
{
"column_values": a
// Other data here...
]
}
]
},
"account_id": 123123123
}

As you can see, this is missing the id (which I don’t need as I know that to make the query) and the name.


How can I get the same data as I did in the first query, but just for a single item?


Thanks

Hello there @Yossu !


You can use something like this:


query {
items(ids: 123456789) {
name
id
column_values {
id
value
type
text
column {
title
}
}
}
}

Or if you want to keep the original query, you can filter by the name of the items like this:


{
boards(ids: [123456789]) {
items_page(
limit: 50
query_params: {rules: [{column_id: "name", compare_value: ["Item 1"]}]}
) {
cursor
items {
id
name
column_values {
id
text
value
column {
id
type
title
settings_str
}
}
}
}
}
}

I hope that helps!


Cheers,

Matias


@Matias Thanks for the reply. Your query as shown works fine, however it searches on the name. I want to search on the Id.


I tried changing it as follows…


query_params: {rules: :{column_id: "id", compare_value: :"123456879"]}]}

…but this gave a message “Column not found”.


I don’t really understand this, as your query clearly has a column named “id” right below the “name” column, and the results show it.


Any idea what I’m doing wrong? Thanks again


Hello again,


Matias here!


You can not use the second query to filter by ID.


The “id” you see is not a column. It is a field that can be retrieved via API.


You would need to use the first one I sent with the ID in the arguments.


query {
items(ids: 123456789) {
name
id
column_values {
id
value
type
text
column {
title
}
}
}
}

Reply