Updating a Location Property via the Collections API
Overview
Adalo's Location property type stores a complete address record, not raw GPS coordinates. When writing to a Location column through the Collections API, the API expects the full address object in a specific shape. Sending only coordinates, or any partial version of the address object, results in a broken Location field that fails to display, filter, or render in map components.
This document covers how to correctly format Location property writes through the Collections API, what to do when only GPS coordinates are available, and when to use a different property type instead.
Before You Begin
Confirm the following before writing to a Location property through the Collections API:
The app's API key is available from the API Documentation panel (Settings, then App Access).
The App ID and Collection ID for the target collection are known.
The exact name of the Location property column being updated is known.
The source data is either a complete address, or there is a way to reverse-geocode raw coordinates (for example, using Google's Geocoding API) before the API call.
The Location property requires all four of the following top-level keys in every write:
placeIdfullAddresscoordinates(containinglatitudeandlongitude)addressElements(containingaddress1,address2,city,region,country,postalCode)
Use the table below to determine which path applies before starting the walkthrough:
Full address text
Location
Full address object (geocode first if only the string is available)
GPS coordinates, address needed
Location
Reverse-geocode, then send the full address object
GPS coordinates, address not needed
Two Number columns
{ "Latitude": 39.78, "Longitude": -89.65 }
The Collections API does not perform reverse-geocoding on inbound writes. Whatever payload is sent is exactly what gets stored. There is no enrichment or transformation on Adalo's side.
Walkthrough
Identify the right endpoint
Use the following endpoint depending on whether the request is creating or updating a record:
Create record:
POST https://api.adalo.com/v0/apps/{appId}/collections/{collectionId}Update record:
PUT https://api.adalo.com/v0/apps/{appId}/collections/{collectionId}/{recordId}
Authenticate using the API key from the app's API Documentation panel.
Prepare the address payload
The shape Adalo expects for a Location field is:
Replace LocationField with the actual name of the Location property in the collection.
If the source data is already a complete address, map it into this structure and skip to Step 4. If the source data is raw GPS coordinates and a real address needs to be stored, continue to Step 3.
Reverse-geocode raw coordinates
When the source data is { latitude, longitude } (for example, from a device sensor, a third-party tracker, or an IoT feed), reverse-geocode the coordinates before calling Adalo:
Call Google's Geocoding API (or another provider) with the lat/lng pair.
Map the response into the Location object:
placeIdfrom the result'splace_idfullAddressfromformatted_addresscoordinatesfrom the original lat/lng (or the geocoder'sgeometry.location)addressElementsfromaddress_components(street number combined with route goes intoaddress1,localitygoes intocity,administrative_area_level_1goes intoregion, and so on)
Send the request
POST or PUT the complete Location object to the Collections API endpoint identified in Step 1. The API will store the full object, and the Location field will work correctly across display, filtering, and map components.
Alternative path: When a real address is not needed
If only raw coordinate values are needed (for distance math, custom map pins, or passing to an external API), skip the Location property type entirely:
Add two Number properties to the collection, named
LatitudeandLongitude.Write to them directly through the Collections API:
Known Limitations and Gotchas
The API does not reverse-geocode inbound writes. Sending coordinates alone, or any partial version of the address object, gets stored exactly as sent. The Location field will be malformed and will break display, filtering, and any map component that reads from it.
Partial writes silently corrupt the field. There is no validation error returned for an incomplete address object. The write will succeed and the data will appear saved until something tries to read it.
All four top-level keys are required.
placeId,fullAddress,coordinates, andaddressElementsmust all be present. Missing any one of them counts as a malformed write.Example of a write that will not work:
This stores exactly that shape and leaves the Location property in a broken state.
The Location property is not interchangeable with raw coordinate fields. When raw coordinates are all that's needed, use two Number columns instead. Forcing a Location property to do that job adds complexity for no benefit.
Learn More
Last updated
Was this helpful?