Support Topics Documentation Slack YouTube Blog

"Establishing Relations with GeoPoints via API" not working correctly

(Destry Hunt) #1

When calling the following api, which is cited in the current documentation, only the portion of the call saving the data appears to work. The nested json that should both create a relation with a Geopoint and persist the latitude/longitude data in the Geopoint table does not appear to get a response when sent via api. Below is the url of the api call, the json that is sent, and then the json that is returned by the api (all performed within Postman). I also included the information found within the “headers” portion of Postman, although I am not sure if it means anything:
//this is the json sent to api endpoint:

“Race”: “White”,
“Hair_Color”: “Blonde”,
“Sex”: “Male”,
“___class”: “GeoPoint”,
“latitude”: 34.268491,
“longitude”: -105.596403,

//this is the json returned from the api call:

“created”: 1532930493497,
“Race”: “White”,
“Sex”: “Male”,
“___class”: “incident_test”,
“ownerId”: null,
“updated”: null,
“Hair_Color”: “Blonde”,
“objectId”: “9623FB28-7B20-74F9-FFC9-8BCC86706400”
under ‘headers’
access-control-allow-headers →Origin, application-type, Content-Type, request, user-token, auth-keyaccess-control-allow-methods →POST, GET, OPTIONS, PUT, DELETE, PATCHaccess-control-allow-origin →chrome-extension://fhbjgbiflinjbdggehcddcbncdddomopcache-control →no-cache, : no-store, no-cache, must-revalidate, privateconnection →keep-alivecontent-length →182content-type →application/jsondate →Mon, 30 Jul 2018 06:02:58 GMTexpires →Thu, 01 Jan 1970 00:00:01 GMTpragma →: no-cacheserver →nginx

(Vladimir Upirov) #2

Hi Destry

Unfortunately, it doesn’t work since Backendless 4.x, I’ve created an internal ticket BKNDLSS-17378 to solve that in docs.

For establishing Data/Geo relations you should use this api

Thanks, Vlad

(Destry Hunt) #3

Well, that is sure disappointing. Thank you for the quick response, Vlad.

(Destry Hunt) #4

So, I just created the relation with the API, and it worked, but I want to make sure I am not making this a longer process than necessary. Instead of calling an API that would save the data, the geopoint, AND the relation at the same time, I am calling three separate API’s; first an api to save the data, then an api to save the geopoint, and then an api to create the relation between the data and geopoint. Am I really supposed to run three separate API’s?

(Anton Govorushkin) #5

Yes, current implementation requires an existing object and a geopoint. So if non of them exist - 3 calls required


(Destry Hunt) #6

Ok, thank you, Anton.

(Marcio Prudencio) #7

Greetings to everyone! I’m trying to create a relation between Users and Geopoints via Rest API, according the posts above using 3 steps but no success. 1. Is creating the user = OK 2. Creating Geoppoint = OK 3. Creating the relation NOK.

I put the screenshot in my drive, could you guys give a look and help me out please?

Geopoint Relation - Rest API

To create a Relation (No errors):

url: `/data/Users/${userId}`,
method: 'put',
baseURL: `${metrics.dbConnect}`,
headers: { 'Content-Type': 'application/json', 'application-type':'REST' },
data: {
	geopoint: {
		___class: "GeoPoint",
		latitude: `${lat}`,
		longitude: `${lon}`

Thanks in advance!

(Mark Piller) #8


Please see the following article in the docs describing how to set the relation:

Keep in mind that the geopoint must be already saved in the database at the time when you establish a relation.