Using Connect Enterprise Web Services |
|||
| Architecture > Making your first API call > Add filters and sorts | |||
Many actions in the API allow you to add a filter to return only certain response elements or a sort to display response elements in a certain order.
A filter is a special parameter that starts with the keyword filter, followed by an optional modifier, then a field name and a value. These are all examples of filters:
filter-name=jazz doe (which matches results with the exact name jazz doe)filter-like-name=jazz (which matches any results that contain jazz in the name)filter-out-type=user (which returns any results that do not have a type of user)These are just a few filter types, and you can find more in filter-definition. Check an action in the reference (at Action reference) to see whether its response can be filtered. In general, if an action allows filters, you can use them on any response element or attribute.
A sort is another special parameter that starts with the keyword sort (or sort1 or sort2), followed by a field name and then one of the keywords asc or desc, for example:
sort-name=asc (to sort in ascending order by name)sort-group-id=desc (to sort in descending order by group-id)These are just a few sort examples. You can test sorts in the browser or see sort-definition for more.
principal-list again, displaying only groups and sorting them alphabetically by name:https://example.com/api/xml?action=principal-list&filter-type=group&sort-name=asc
https://example.com/api/xml?action=principal-list&filter-name=developers
This time, only one group is returned:
<?xml version="1.0" encoding="utf-8" ?>
<results>
<status code="ok" />
<principal-list>
<principal principal-id="2007105030" account-id="624520"
type="group" has-children="true" is-primary="false"
is-hidden="false">
<name>developers</name>
<login>developers</login>
</principal>
</principal-list>
</results>
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/breeze/6/xml_api/01_usin7.htm