Country

Learn how to filter, read, update, and clear the country column on monday boards using the platform API

The country column represents a country from the list of available countries. You can filter, read, update, and clear the country column via the API.

Filter the country column

Using the items_page object, you can easily filter a board's items by specific columns or column values. The table below contains the country column's supported operators and compare values.

Operators

Compare values

any_of

not_any_of

is_empty

null

is_not_empty

null

contains_text

The partial or whole country name to filter by as a string

not_contains_text

The partial or whole country name to filter by as a string

Examples

The following example returns all items on the specified board with a country column value of 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 ($board_id: [ID!], $column_id: ID!, $operator: ItemsQueryRuleOperator!, $compare_value:CompareValue!) { boards (ids: $board_id) { items_page (query_params: {rules: [{column_id: $column_id, compare_value: $compare_value, operator:$operator}]}) { items { id name } } } }`;
const variables = {
  board_id: 9571351437,
  column_id: "country",
  compare_value: ["UY"], // country code
  operator: "any_of",
};

const response = await mondayApiClient.request(query, variables);

Read the country column

You can query the country column using the column_values object that enables you to return column-specific subfields by sending a fragment in your query. Values for the country column are of the CountryValue type.

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

FieldDescription
column Column!The column the value belongs to.
country CountryThe country's value.
id ID!The column's unique identifier.
text StringThe column's value as text. Returns "" if the column has an empty value.
type ColumnType!The column's type.
updated_at DateThe column's last updated date.
value JSONThe column's JSON-formatted raw value.

Update the country column

You can update a country column using the change_multiple_column_values mutation and passing a JSON string in the column_values argument. Simple string updates are not supported.

JSON

To update a country column, send the ISO-2 country code (a two-letter code) and the country name in the column_values argument.

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 ($myBoardId:ID!, $myItemId:ID!, $myColumnValues:JSON!) { change_multiple_column_values(item_id:$myItemId, board_id:$myBoardId, column_values: $myColumnValues) { id } }`;
const variables = {
  myBoardId: 9571351437,
  myItemId: 9571351485,
  myColumnValues: JSON.stringify({
    country_mksrwr0v: {
      countryCode: "SG",
      countryName: "Singapore"
    } // country_mksrwr0v is the column ID
  }),
};

const response = await mondayApiClient.request(query, variables); 

Clear the country column

You can also clear a country column using the change_multiple_column_values mutation and passing null or an empty object in the column_values argument.

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 ($myBoardId:ID!, $myItemId:ID!, $myColumnValues:JSON!) { change_multiple_column_values(item_id:$myItemId, board_id:$myBoardId, column_values: $myColumnValues) { id } }`;
const variables = {
  myBoardId: 9571351437,
  myItemId: 9571351485,
  myColumnValues: JSON.stringify({
    country_mksrwr0v: null // country_mksrwr0v is the column ID
  }),
};

const response = await mondayApiClient.request(query, variables);