Page 1 of 1

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

Posted: Fri Aug 08, 2014 9:05 pm
by Mike Maughan

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!


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

Posted: Fri Aug 08, 2014 11:12 pm
by Mike Maughan

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...


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

Posted: Mon Aug 11, 2014 9:25 am
by Maryna Brodina

Hello!

Thank you for update!


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

Posted: Mon Jun 01, 2015 9:21 am
by EJLD

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 );