Learn how to filter, read, update, and clear the country column on monday boards using the platform API
The country column represents a country selected from the list of available countries.
Via the API, the country column supports read, filter, update, and clear operations.
Column Type | Implementation Type | Supported Operations |
|---|---|---|
|
|
|
Queries
Country columns can be queried through the column_values field on items queries using an inline fragment on CountryValue.
query {
items(
ids: [
1234567890
9876543210
]
) {
column_values {
... on CountryValue {
country
updated_at
}
}
}
}import { ApiClient } from "@mondaydotcomorg/api";
const mondayApiClient = new ApiClient({ token: myToken });
const query = `query($itemIds: [ID!]) { items (ids:$itemIds) { column_values { value ... on CountryValue { country { code name } } } } }`;
const variables = {
itemIds: [9571351485, 9572374902],
};
const response = await mondayApiClient.request(query, variables);Fields
You can use the following fields to specify what information your CountryValue implementation will return.
Field | Description | Supported Fields |
|---|---|---|
column | The column the value belongs to. | |
country | The selected country's value, including name and code. | code |
id | The column's unique identifier. | |
text | The column value as text. Returns | |
type | The column's type. | |
updated_at | The column's last updated date. | |
value | The raw JSON-formatted column value. |
Filter
You can filter items by country values using the items_page object. The country column supports the following operators:
Operators | Compare Values |
|---|---|
|
|
|
|
|
|
|
|
| Partial or full country name (e.g., "United") |
| Partial or full country name (e.g., "United") |
Example
The following example returns all items whose country column equals Uruguay:
query {
boards(ids: 1234567890) {
items_page(
query_params: {
rules: [
{
column_id: "country"
compare_value: ["UY"]
operator: any_of
}
]
}
) {
items {
id
name
}
}
}
}import { ApiClient } from "@mondaydotcomorg/api";
const mondayApiClient = new ApiClient({ token: myToken });
const query = `
query ($boardId: [ID!], $columnId: ID!, $operator: ItemsQueryRuleOperator!, $compareValue: CompareValue!) {
boards(ids: $boardId) {
items_page(
query_params: {
rules: [
{ column_id: $columnId, compare_value: $compareValue, operator: $operator }
]
}
) {
items { id name }
}
}
}
`;
const variables = {
boardId: 9571351437,
columnId: "country",
compareValue: ["UY"],
operator: "any_of",
};
const response = await mondayApiClient.request(query, variables);Mutations
Update
You can update a country column using the change_multiple_column_values mutation by passing a JSON object.
To update the country, send an ISO-2 country code and the country’s name:
mutation {
change_multiple_column_values(
item_id: 9876543210
board_id: 1234567890
column_values: "{\"country\": {\"countryCode\": \"US\", \"countryName\": \"United States\"}}"
) {
id
}
}import { ApiClient } from "@mondaydotcomorg/api";
const mondayApiClient = new ApiClient({ token: myToken });
const query = `
mutation ($boardId: ID!, $itemId: ID!, $columnValues: JSON!) {
change_multiple_column_values(
item_id: $itemId
board_id: $boardId
column_values: $columnValues
) {
id
}
}
`;
const variables = {
boardId: 9571351437,
itemId: 9571351485,
columnValues: JSON.stringify({
country_mksrwr0v: {
countryCode: "SG",
countryName: "Singapore"
}
})
};
const response = await mondayApiClient.request(query, variables);Clear
You can clear a country column by passing null or {}:
mutation {
change_multiple_column_values(
item_id: 9876543210
board_id: 1234567890
column_values: "{\"country\": null}"
) {
id
}
}import { ApiClient } from "@mondaydotcomorg/api";
const mondayApiClient = new ApiClient({ token: myToken });
const query = `
mutation ($boardId: ID!, $itemId: ID!, $columnValues: JSON!) {
change_multiple_column_values(
item_id: $itemId
board_id: $boardId
column_values: $columnValues
) {
id
}
}
`;
const variables = {
boardId: 9571351437,
itemId: 9571351485,
columnValues: JSON.stringify({
country_mksrwr0v: null
})
};
const response = await mondayApiClient.request(query, variables);