Zhyano Zhyano - 4 months ago 16
reST (reStructuredText) Question

Kinvey Rest Api Modify return-data of App Call according to the requesting user

To reduce the amount of downloaded data and thus data and CPU usage, I want to remove entities not matching an attribute of the calling user from the data returned, only using the Kinvey REST API.


To clarify my wish, here an example:

User ID=1

Data:

ID=1, Value='a'

ID=3, Value='b'

ID=2, Value='c'

ID=1,Value='d'

ID=2,Value='e'

Now I want to reduce the data to only the entities matching the Users ID, so

Value='a' and Value='d'

Any suggestions would be greatly appreciated. Thanks!

Answer

First, please do not use the REST API, but use an appropriate SDK for your development platform. The REST API's handshakes for login, maintaining your token, etc. is all quite hard and the SDK's do the hard for you.

Each SDK has operators for querying. For instance, with Swift, it'll look like this: http://devcenter.kinvey.com/ios/guides/datastore#operators

KCSQuery(onField: "colors", usingConditional: .KCSAll, forValue: [1])

For completeness, in the REST API this would be modeled with the query parameter, like this:

?query={"ID":1}
Comments