Mike Maughan
Posts: 0
Joined: Wed Feb 19, 2014 10:55 pm

API REST curl (using php), how do you restrict the appery db collection fields it returns?

How do you limit the response fields on an api rest service using curl? While I have the response variables limited to the ones I want in the rest service it returns the entire collection, all of the fields. So what do I need to pass along to limit the collection fields that are returned?

Can you put a $select=field1,field2,field3 in the url?

Thanks!

Mike Maughan
Posts: 0
Joined: Wed Feb 19, 2014 10:55 pm

API REST curl (using php), how do you restrict the appery db collection fields it returns?

I found the solution. You append ?proj=insert-encoded-json-here to the $url variable.

You can construct that value with Projection as shown here:
http://devcenter.appery.io/documentat...

EJLD
Posts: 0
Joined: Sun Jun 08, 2014 11:03 pm

API REST curl (using php), how do you restrict the appery db collection fields it returns?

this was helpful to me. thks
in case sb interested in server code:

// projection on those fields only
params.proj = { '_id': 1, 'fieldName1': 1, 'fieldName2': 1, 'fieldName3': 1 };

// the query ...
var query = Collection.query(DB_id, collectionName, params );

Return to “Issues”