Location
The location column stores a location with longitude and latitude precision (but displayed with text). Our API supports this column, so you can read and update the location column via the API.
Reading the location column
You can return the data in a location column in two different formats. The text field will return the data as a simple string, and the value field will return the data as a JSON string.
{
"text": "Taj Mahal",
"value": "{\"lat\":\"27.1751448\",\"lng\":\"78.0421422\",\"city\":{\"long_name\":\"Agra\",\"short_name\":\"Agra\"},\"street\":null,\"address\":\"Taj Mahal\",\"country\":{\"long_name\":\"India\",\"short_name\":\"IN\"},\"placeId\":\"ChIJbf8C1yFxdDkR3n12P4DkKt0\",\"changed_at\":\"2022-07-21T12:00:00.000Z\",\"streetNumber\":null}"
}
Updating the location column
You can update a location column with both a simple string and a JSON string.
Simple strings
To update a location column, send the latitude, longitude, and address of the location separated by spaces (optional).
For example: "40.6892494 -74.0445004" or "29.9772962 31.1324955 Giza Pyramid Complex"
NOTE
The address is not verified to match the latitude/longitude. It is just used as the text displayed in the cell. In case no address is provided, the address will be displayed as "unknown".
The legal values for latitude are between -90.0 and 90.0 exclusive, and for longitude between -180.0 and 180.0 inclusive. If the updated values exceed those ranges, a ColumnValueException will be raised.
JSON
To update a location column, send the latitude, longitude, and address of the location (optional).
For example: "{\"lat\":\"29.9772962\",\"lng\":\"31.1324955\",\"address\":\"Giza Pyramid Complex\"}"
mutation {
change_multiple_column_values(item_id:11111, board_id:22222, column_values: "{\"location3\" : {\"lat\":\"29.9772962\",\"lng\":\"31.1324955\",\"address\":\"Giza Pyramid Complex\"}}") {
id
}
}
fetch ("https://api.monday.com/v2", {
method: 'post',
headers: {
'Content-Type': 'application/json',
'Authorization' : 'YOUR_API_KEY'
},
body: JSON.stringify({
query : "mutation ($myBoardId:Int!, $myItemId:Int!, $myColumnValues:JSON!) { change_multiple_column_values(item_id:$myItemId, board_id:$myBoardId, column_values: $myColumnValues) { id } }",
variables : JSON.stringify({
myBoardId: YOUR_BOARD_ID,
myItemId: YOUR_ITEM_ID,
myColumnValues: "{\"location3\" : {\"lat\" : \"29.9772962\", \"lng\": \"31.1324955\", \"address\": \"Giza Pyramid Complex\"}}"
})
})
})
You can find the Postman request to change the location column here.
Clearing the location column
You can clear the location column using a change_multiple_column_values
mutation.
mutation {
change_multiple_column_values(item_id: 2973227073, board_id: 2973227049, column_values: "{\"location\":{}}") {
id
}
}
Have questions?
Join our developer community! You can share your questions and learn from fellow users and monday.com product experts.
Donβt forget to search before opening a new topic!
Updated 3 days ago