How to query on user's object fields and custom fields in Appcelerator API using PHP CURL?
Appcelerator Cloud Services provides APIs for querying and searching ACS objects. The query APIs allow you to perform custom database-style searches, while search APIs perform a full text search using the ACS search engine.
1. Query On Custom Field. For Example, My custom field is 'pranay'.
Scenario: Now fetch the user who having custom field value pranay = 23.
PHP CURL Code:
2. Query on predefined field like: username, first_name...etc.
PHP CURL Code:
Note: In query you can use multiple operators sign like above used "$eq" which tends "equalto". please refer below link for more details.
Reference Document: http://docs.appcelerator.com/cloud/latest/#!/guide/search_query-section-query-on-custom-field-results-in-descending-order
1. Query On Custom Field. For Example, My custom field is 'pranay'.
Scenario: Now fetch the user who having custom field value pranay = 23.
PHP CURL Code:
$key = 'YourAppceleratorKeyHere';
$curl_handle = curl_init("https://api.cloud.appcelerator.com/v1/users/query.json?key=" . $key.'&pretty_json=true&count=true&where={"pranay":{"$eq":23}}');
curl_setopt($Curl_Session, CURLOPT_RETURNTRANSFER, true); $resp = curl_exec($curl_handle);
curl_close($curl_handle);
print_r($resp);
2. Query on predefined field like: username, first_name...etc.
PHP CURL Code:
$curl_handle = curl_init("https://api.cloud.appcelerator.com/v1/users/query.json?key=" . $key.'&pretty_json=true&count=true&where={"username":"pgtest3"}');
curl_setopt($Curl_Session, CURLOPT_RETURNTRANSFER, true); $resp = curl_exec($curl_handle);
curl_close($curl_handle);
print_r($resp);
Note: In query you can use multiple operators sign like above used "$eq" which tends "equalto". please refer below link for more details.
Reference Document: http://docs.appcelerator.com/cloud/latest/#!/guide/search_query-section-query-on-custom-field-results-in-descending-order
How to query on user's object fields and custom fields in Appcelerator API using PHP CURL?
Reviewed by Web Technology Funda
on
2:34:00 AM
Rating:
No comments