Hi,
I’m trying to use the API to set the Location field type, everything I try returns a 500 error. I don’t have any issues with other field types.
Does anyone know how to get this working; I can’t find anything in the documentation.
Thanks, Matt
Hi,
I’m trying to use the API to set the Location field type, everything I try returns a 500 error. I don’t have any issues with other field types.
Does anyone know how to get this working; I can’t find anything in the documentation.
Thanks, Matt
Updating my own post - I have now contacted adalo support.
I wrote a test script which tries all the following interactions. The response code is success and even shows the data in the response structure, however it’s not actually populated in the database.
test script output
Testing Adalo Location Field Formats
Step 1: Creating test Flying Site...
✓ Created Flying Site with ID: 779
Testing format: 1. Latitude/Longitude (caps)
Data: {
"Location": {
"Latitude": 33.1371234,
"Longitude": -84.6111662
}
}
HTTP Code: 200
✓ SUCCESS!
Location field in response: {"Latitude":33.1371234,"Longitude":-84.6111662}
🎉 THIS FORMAT WORKS!
--------------------------------------------------------------------------------
Testing format: 2. Full Address only
Data: {
"Location": {
"Full Address": "49PQ+RG Alps, GA, USA"
}
}
HTTP Code: 200
✓ SUCCESS!
Location field in response: {"Full Address":"49PQ+RG Alps, GA, USA"}
🎉 THIS FORMAT WORKS!
--------------------------------------------------------------------------------
Testing format: 3. Full Address + Latitude/Longitude
Data: {
"Location": {
"Full Address": "49PQ+RG Alps, GA, USA",
"Latitude": 33.1371234,
"Longitude": -84.6111662
}
}
HTTP Code: 200
✓ SUCCESS!
Location field in response: {"Latitude":33.1371234,"Longitude":-84.6111662,"Full Address":"49PQ+RG Alps, GA, USA"}
🎉 THIS FORMAT WORKS!
--------------------------------------------------------------------------------
Testing format: 4. Name + Full Address + Lat/Lng
Data: {
"Location": {
"Name": "Alps Flying Site",
"Full Address": "49PQ+RG Alps, GA, USA",
"Latitude": 33.1371234,
"Longitude": -84.6111662
}
}
HTTP Code: 200
✓ SUCCESS!
Location field in response: {"Name":"Alps Flying Site","Latitude":33.1371234,"Longitude":-84.6111662,"Full Address":"49PQ+RG Alps, GA, USA"}
🎉 THIS FORMAT WORKS!
--------------------------------------------------------------------------------
Testing format: 5. All Location sub-properties
Data: {
"Location": {
"Full Address": "49PQ+RG Alps, GA, USA",
"Name": "Alps Flying Site",
"Street Address": "49PQ+RG",
"City": "Alps",
"State\/Region": "GA",
"Country": "USA",
"Postal Code": "30218",
"Latitude": 33.1371234,
"Longitude": -84.6111662
}
}
HTTP Code: 200
✓ SUCCESS!
Location field in response: {"City":"Alps","Name":"Alps Flying Site","Country":"USA","Latitude":33.1371234,"Longitude":-84.6111662,"Postal Code":"30218","Full Address":"49PQ+RG Alps, GA, USA","State\/Region":"GA","Street Address":"49PQ+RG"}
🎉 THIS FORMAT WORKS!
--------------------------------------------------------------------------------
Testing format: 6. Street Address + City + State
Data: {
"Location": {
"Street Address": "49PQ+RG",
"City": "Alps",
"State\/Region": "GA",
"Latitude": 33.1371234,
"Longitude": -84.6111662
}
}
HTTP Code: 200
✓ SUCCESS!
Location field in response: {"City":"Alps","Latitude":33.1371234,"Longitude":-84.6111662,"State\/Region":"GA","Street Address":"49PQ+RG"}
🎉 THIS FORMAT WORKS!
--------------------------------------------------------------------------------
Testing format: 7. Lowercase versions
Data: {
"Location": {
"full_address": "49PQ+RG Alps, GA, USA",
"latitude": 33.1371234,
"longitude": -84.6111662
}
}
HTTP Code: 200
✓ SUCCESS!
Location field in response: {"latitude":33.1371234,"longitude":-84.6111662,"full_address":"49PQ+RG Alps, GA, USA"}
🎉 THIS FORMAT WORKS!
--------------------------------------------------------------------------------
Testing format: 8. Snake case versions
Data: {
"Location": {
"full_address": "49PQ+RG Alps, GA, USA",
"street_address": "49PQ+RG",
"city": "Alps",
"state_region": "GA",
"country": "USA",
"postal_code": "30218",
"latitude": 33.1371234,
"longitude": -84.6111662
}
}
HTTP Code: 200
✓ SUCCESS!
Location field in response: {"city":"Alps","country":"USA","latitude":33.1371234,"longitude":-84.6111662,"postal_code":"30218","full_address":"49PQ+RG Alps, GA, USA","state_region":"GA","street_address":"49PQ+RG"}
🎉 THIS FORMAT WORKS!
--------------------------------------------------------------------------------
✓ Test complete. Flying Site ID: 779
Check the Adalo database to see which format actually populated the Location field.
Hi @MattTakharRC,
This isn’t officially documented but updating a location property via API will work if you use the same JSON structure that Adalo returns for a location property value. :
{
"placeId": "ChIJYRwZ8uFv5kcRO2fKc5UDu74",
"coordinates": {
"latitude": 48.8583701,
"longitude": 2.2922926
},
"fullAddress": "Champ de Mars, 5 Avenue Anatole France, 75007 Paris, France",
"addressElements": {
"city": "Paris",
"region": "Île-de-France",
"country": "France",
"address1": "5 Avenue Anatole France",
"address2": "",
"postalCode": "75007"
}
}
Thank you and have a great day!
Thank you - this works great!
Do you have the JSPN structure for setting the Created by field via the API with the user?
You’re very welcome!
Created by means a one to many relationship property right? You need the user’s record ID from the users collection and then you can simply map that. See this tutorial video recorded by @Victor for example! : https://youtu.be/AK3qUzRiy3o (Now you can send the ID directly from the app instead using a List module : Expose Record ID for Filters/Visibility | Voters | Adalo)
Thank you and have a great day!
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.