Not able to retrieve single record via REST API

I am not able to retrieve single Person record from the Person table via REST API.

even after providing objectId as filter it is retrieving all the records available in the table.

Could you please help me indicating, where am I making mistake.

This is my simple request end point:

https://eu-api.backendless.com/DD600E9F-096D-8216-FF04-ABE42DC3D500/C5B4FC4C-1BBC-42D3-B5CE-A4B3613DFF2C/data/Person?objectId=‘00249474-F2A5-4707-862A-4F277CEE661B’&user-token=007434E1-BA1B-45F8-9382-89750AEE820F

If I paste above in browser I receive following, this is exactly all the 4 records available in the table

[{“created”:1640606559824,“name”:“Henry”,“___class”:“Person”,“ownerId”:null,“updated”:null,“age”:23,“objectId”:“00249474-F2A5-4707-862A-4F277CEE661B”},{“created”:1640199927003,“name”:“Joe”,“___class”:“Person”,“ownerId”:null,“updated”:null,“age”:25,“objectId”:“26DA5331-ECB5-4FC0-96AA-9ED8E654C6FB”},{“created”:1640606579155,“name”:“John”,“___class”:“Person”,“ownerId”:null,“updated”:null,“age”:44,“objectId”:“7932CEC9-642A-4559-A10F-A1EF78425A1A”},{“created”:1640197031415,“name”:“Sumanta”,“___class”:“Person”,“ownerId”:null,“updated”:null,“age”:12,“objectId”:“E08F6611-3B64-427A-85AA-BF43BA66D13C”}]

Hi @Sumanta_Basu,

Why did you compose your request in such a way?

According to the documentation, your request should look the following way:
https://eu-api.backendless.com/DD600E9F-096D-8216-FF04-ABE42DC3D500/C5B4FC4C-1BBC-42D3-B5CE-A4B3613DFF2C/data/Person/00249474-F2A5-4707-862A-4F277CEE661B

From docs:

Find object by ID:


curl "https://xxxx.backendless.app/api/data/Person/XXXX-XXXX-XXXX-XXXX"

Also keep in mind that user-token should be passed in headers, not in query params.
This pointed in the “Maintain User Session” part of our docs:
https://backendless.com/docs/rest/users_login.html#maintaining-user-session

Regards,
Stanislaw

1 Like

Many thanks Stanislaw, I understand the mistake, will follow as you suggested.

and yes, passing user-token via query params was a quick&dirty check, do not follow in code actually.

Thanks a lot for your quick help :slight_smile: