[REST] GET ObjectID of last data object in table

I am using REST in Python.

According to the documentation, you can find the last data object in a table with https://api.backendless.com/<version>/data/<table-name>/last

You can also get the ObjectID of an object by adding parameters to the URL https://api.backendless.com/<version>/data/<table-name>?props=ObjectID&where=Clause

What I would like to know is how to get the ObjectID of the last data object in the table.

Thanks in advance.

Hi Eric,

When you retrieve the last object in a table, the JSON which comes back will have the objectId property. It will contain the value you’re looking for.

Regards,
Mark

Hey Mark,

Thanks for the reply. ObjectID is returned but along with all the other properties. Is there a way to capture just the objectID value and assign it to a variable? Thanks.

Eric

I was going to suggest adding props=objectId, but that does not work with /last. I think the penalty for getting all of the properties in the response for /last and using only objectId is minimal. What do you think?

Regards,
Mark

Ah, I was unfamiliar with JSON at the time of asking the question. I was able to use the json module in Python to capture the objectId.

import json
objid = json.loads(datastring)["objectId"]