I need to make a method that adds one or more objects to a geopoint that might already exist in the database and I’m looking for the best way to do that because going through a cascade of async callbacks is less than optimal.
The flow that I think of right now is as follows:
Check if geopoint exists by search in category based on lat & lon.
Yes: Get geopoint object from result and inject new metadata or update existing metadata and use a PATCH request to update existing geopoint object.
No: Add new geopoint object with wanted metadata and use a PUT request to add it.
Is there a better approach to this flow I described?
As of right now I think this whole flow is not possible. Since the request URL quickly surpasses the maximum URL length I can work with as the metadata grows with each embedded data object.
Yes, if you use REST api the best way to update existing geo point is to use PATCH request.
You need to know only point id for update.
https://backendless.com/documentation/geo/rest/geo_updating_a_geo_point.htm
Keep in mind this rules, if you use our SDK (for example in Java/Android)
https://backendless.com/documentation/geo/android/geo_updating_a_geo_point.htm
That’s not what exactly the answer i’m looking for.
I’m doing readings which are attached to geopoints. Since I expect there to be many readings that eventually might have the same latitude and longitude I’m trying to make a 1-to-Many relation between the geopoint and my custom data object’s.
Because there is no saying in how many linked custom data object’s there can be at one given moment I’m running in to a wall.
If I use the patch call I must supply existing metadata of the geopoint together with the new object I’d like to add else all the old relations will be deleted. Whether I can do this by only supplying objectId’s or the whole object in JSON does not really matter because I’ll still hit the 4000 url limit that I have to work with way to fast.
I’ve added a file with the url with full metadata I had when I wanted to a new relation to a geopoint that already had a relation with 10 other objects. My point being: Why is the metadata for geopoints embedded in the URL and not in the body just like the update methods for Data Objects?
Oh, I suggest opening the text file in notepad++ or something similar. The message won’t get across if you don’t see the layout. And I’ve decoded the URL for better reading. The actiual request was indeed encoded.
414 Request-URI Too Long.txt (3.73kB)
Thanks for you suggestion. We will open discussion on this issue.
About current solution:
You may create special metadata object for big data (in separate table) and make relation one-to-one for every point. Then, if you want to update metadata of your point, you need just take the objectId which contains in metadata, and then update another object.