Backendless Support
 
Answered

Retrieve a User's Friends with their relations(REST)

Greetings,

Am trying to retrieve a users friends with one of their related columns(profilePic) as below but getting an error

  1. https://api.backendless.com/application-id/REST-api-key/data/Users?where=Users[friends].objectId='XXXX-XXXX-XXXX-XXXX'Users[friends].profilePic.objectId='XXXX-XXXX-XXXX-XXXX'

The error

  1. {"code":1017,"message":"Invalid where clause","errorData":{}}

Regards,

George

Leave a Comment

Comments (4)

photo
1

Hello,

you have to use url encoded string for where, for example your where clause should be: https://api.backendless.com/application-id/REST-api-key/data/Users?where=Users%5Bfriends%5D.objectId%3D%27XXXX-XXXX-XXXX-XXXX%27Users%5Bfriends%5D.profilePic.objectId%3D%27XXXX-XXXX-XXXX-XXXX%27

also I belive you have missed 'and' statement Users[friends].objectId='XXXX-XXXX-XXXX-XXXX' and Users[friends].profilePic.objectId='XXXX-XXXX-XXXX-XXXX'

photo
1

Hi,

Same error with

  1. https://api.backendless.com/application-id/REST-api-key/data/Users?where=Users%5Bfriends%5D.objectId%3D%27XXXX-XXXX-XXXX-XXX%27%26Users%5Bfriends%5D.profilePic.objectId%3D%27XXXX-XXXX-XXXX-XXXX%27&offset=0&pageSize=20

photo
1

you write Users[friends].objectId='XXXX-XXXX-XXXX-XXX'&Users[friends].profilePic.objectId='XXXX-XXXX-XXXX-XXXX'

but should be Users[friends].objectId='XXXX-XXXX-XXXX-XXX' and Users[friends].profilePic.objectId='XXXX-XXXX-XXXX-XXXX'

so the problem is that you use '&' instead of 'and'

do not forget about url encode

photo
1

Also do not create more then one topic for one question