Country name is not strictly required when updating a country column

The API documentation indicates that both the ISO 3166-1 alpha-2 code and the full country name are required in order to update a column with type Country. While it’s not necessarily difficult to map between the two if one only has one or the other, I wanted to test its requirements and drill down into edge cases.

In doing so, it seems that the country name is not strictly required to have a value and is only required for its property to be present. That is, the column will update, and do so correctly, based entirely on the code.

For example, all of the following mutations update a country column with United States as the visible value and a U.S. flag within the column.

mutation ($itemId: Int!, $boardId: Int!) {
  change_multiple_column_values (
    item_id: $itemId, 
    board_id: $boardId, 
    column_values: "{ \"country_1\": { \"countryCode\": \"US\", \"countryName\": \"United States\" }}"
  ) {
    id
  }
}
mutation ($itemId: Int!, $boardId: Int!) {
  change_multiple_column_values (
    item_id: $itemId, 
    board_id: $boardId, 
    column_values: "{ \"country_1\": { \"countryCode\": \"US\", \"countryName\": \"\" }}"
  ) {
    id
  }
}
mutation ($itemId: Int!, $boardId: Int!) {
  change_multiple_column_values (
    item_id: $itemId, 
    board_id: $boardId, 
    column_values: "{ \"country_1\": { \"countryCode\": \"US\", \"countryName\": \"monday.com\" }}"
  ) {
    id
  }
}

Now, if you query the item back, it will indeed contain whatever countryName you updated it with, whether that’s a valid country name (like the first example) or something useless (like examples 2 and 3).

So, it seems the countryName is not strictly required for updating the field. Now, using a country code that is either obviously bad ("", lj09u9, among others) results in a ColumnValueException, even if countryName is valid (e.g. United States).

It appears, then, that the code is the only true requirement. Is this behavior something I can rely on?

It seems quite clear to me.
You must send a 2-letter ISO-2 Country code (so a valid code) and the Country name.
There’s no restriction on how the Country name must be formatted, it can be any text, so I guess it’s for localization purposes.
You can either send "countryName": "United States" or "countryName": "Stati Uniti d'America". They are both accepted.

As seen in my second example, you can send an empty string for the country name. The existence of the property is the only thing that’s required, but not any meaningful value, localized or otherwise. Personally, sending no text at all does not qualify as sending the country name.

Ok, so what’s the point?
Sorry but I don’t get the reason of your post.

The point is the question at the bottom of the post: Is this behavior something I can rely on? That is, I’m making sure it isn’t simply unintended to not validate the countryName as things can easily get missed when considering the entire API surface.

If it is unintended, then it could be fixed at some point. If I’m then relying on the behavior that the string doesn’t matter, it could cause issues. Sure, once errors start cropping up for others, I could be notified of that, but I’d prefer to avoid that in the first place by confirming the intended behavior.

Hello @riosd!

What you say is correct. And it is like this by design so you can use it as it is :slightly_smiling_face:

Cheers,
Matias

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.