Support Topics Documentation Slack YouTube Blog

Fail to add relation to geopoint via REST API


(Alexander Hartdegen Lee) #1

I was trying to add a geopoint with a relation to an User object:

https://api.backendless.com/v1/geo/points?lat=1.5132&lon=2.5123&metadata=%7B%22myuser%22%3A+%7B%22___class%22+%3A+%22Users%22%2C+%22objectId%22%3A%22CD145AF6-689F-AE1E-FF70-2C991BE4CB00%22%7D%7D&categories=test

Then, I encountered a weird issue whereby I got an error code 36 (Duplicate entry with Column “myuser”).
Prior, I had cleared all the geopoints in my database. Any advice on why this is happening would be appreciated.
Thanks


(Mark Piller) #2

Do you get the error when add a geopoint and the geolocation storage is completely empty?


(Alexander Hartdegen Lee) #3

When I first tried, the geolocation was filled with the sample data generated by the server. I still got the error after I cleared all my geopoints in the geolocation storage.


(Mark Piller) #4

Here’s a CURL request I just tried:

curl -H application-id:MYAPPID -H secret-key:MYRESTKEY -X PUT “http://api.backendless.com/v1/geo/points?lat=1.5132&lon=2.5123&metadata={“myuser”%3A%20{"___class"%20%3A%20"Users"%2C%20"objectId"%3A"5B103644-3577-56AE-FF85-DCC9B1AD1A00"}}&categories=test

Ran it twice, got two points:
http://support.backendless.com/public/attachments/25e76a9f805f61c8111324eb3580f807.jpg</img>


(Alexander Hartdegen Lee) #5

Yah, I tried it on a new app and it works. But it does not work on the app which I am working on right now.


(Kate Maksimenko) #6

Hi Alexander!

Could you check if you use correct objectId in previous request?

Regards,
Kate.


(Alexander Hartdegen Lee) #7

Hi,

yes, I just checked. My bad, the objectId was in fact wrong.

A side note, the error message could have been clearer.

Anyway, thanks for the replies.


(Kate Maksimenko) #8

You are right.
We will make it to more informative.