Andy Parker
Posts: 0
Joined: Wed Mar 27, 2013 10:21 am

Server Code Query with limit and sort

Can you help me with the following server code query against a database please?

I need to query a collection based on username, sorted by a field called datetime, and only return the latest record based on datetime.

I have the following, but the query does not seem to be accepted (despite testing the query in the database query test.

code
var query = '{"username":"bob"}';
var xmlHTTPParameters = {
"headers": {
"X-Appery-Database-Id": dbId,
"X-Appery-Master-Key": masterKey,
"Content-Type": "application/json",
},
"query": query,
"body": JSON.stringify(userObject)
};

XHRResponse[uc] = XHR.send("GET", "https://api.appery.io/rest/1/db/colle...", xmlHTTPParameters);

/code

Return to “Issues”