Difference between revisions of "API Collections List"
Tommy.leung (Talk | contribs) (→Examples) |
Tommy.leung (Talk | contribs) (→Examples) |
||
Line 384: | Line 384: | ||
|- | |- | ||
| fields | | fields | ||
− | | id,name,description, | + | | id,name,description,activate_at,deactivate_at,active,disable_deactivation,slideshow,rotation_speed,updated_at,created_at,items |
|} | |} | ||
Line 544: | Line 544: | ||
</collection> | </collection> | ||
<result-length type="integer">1</result-length> | <result-length type="integer">1</result-length> | ||
+ | <http-status type="integer">200</http-status> | ||
+ | </hash> | ||
+ | </nowiki> | ||
+ | </blockquote> | ||
+ | |} | ||
+ | |||
+ | === Limit to first 2 collections === | ||
+ | ''result_length is 3 because there are 3 collections that can be returned, but the user requested only for 2'' | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Parameters | ||
+ | ! Values | ||
+ | |- | ||
+ | | token | ||
+ | | 1f0qpLwoV5oIcfnU2yvO | ||
+ | |- | ||
+ | | limit | ||
+ | | 2 | ||
+ | |- | ||
+ | | fields | ||
+ | | id,name | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! JSON | ||
+ | |- | ||
+ | | <nowiki>http://api.unroole.com/channels/1/collections.json?token=1f0qpLwoV5oIcfnU2yvO&limit=2&fields=id,name</nowiki> | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | <nowiki> | ||
+ | { "collection" : [ { "id" : 1, | ||
+ | "name" : "test collection" | ||
+ | }, | ||
+ | { "id" : 2, | ||
+ | "name" : "another collection" | ||
+ | } | ||
+ | ], | ||
+ | "http_status" : 200, | ||
+ | "result_length" : 3 | ||
+ | } | ||
+ | </nowiki> | ||
+ | </blockquote> | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! XML | ||
+ | |- | ||
+ | | <nowiki>http://api.unroole.com/channels/1/collections.xml?token=1f0qpLwoV5oIcfnU2yvO&search=test&fields=id,name,description,activate_at,deactivate_at,active,disable_deactivation,slideshow,rotation_speed,updated_at,created_at,items</nowiki> | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | <nowiki> | ||
+ | <?xml version="1.0" encoding="UTF-8"?> | ||
+ | <hash> | ||
+ | <collection type="array"> | ||
+ | <collection> | ||
+ | <id type="integer">1</id> | ||
+ | <name>test collection</name> | ||
+ | </collection> | ||
+ | <collection> | ||
+ | <id type="integer">2</id> | ||
+ | <name>another collection</name> | ||
+ | </collection> | ||
+ | </collection> | ||
+ | <result-length type="integer">3</result-length> | ||
<http-status type="integer">200</http-status> | <http-status type="integer">200</http-status> | ||
</hash> | </hash> |
Revision as of 10:32, 26 June 2012
Contents
Summary
Allows querying for a list of collections in the channel. The query is a wildcard search on:
- name
- description
URI
https://api.unroole.com/channels/[channel-id]/collections
HTTP Method
GET
Required Paramaters
Paramater | Default | Maximum Length | Accepted Values | Description |
---|---|---|---|---|
token | API Persistence Token that identifies this user and its permissions. |
Optional Paramaters
Paramater | Default | Maximum Length | Accepted Values | Description |
---|---|---|---|---|
search | string | The search terms to be used in the query. | ||
limit | TBD | The maximum number of collections to return. | ||
fields | id, name, items | API Collection Fields | List of comma separated fields to be returned in the response. |
Response
Field | Type | Description |
---|---|---|
http_status | integer | API Status Code http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html |
error | Rails default | |
collections | array of API Collection Fields | List of collections |
result_length | integer | Total number of results that could be returned. This may not be the number of collections in the response, as it is truncated by limit parameter. |
Examples
All collections on the channel
Parameters | Values |
---|---|
token | 1f0qpLwoV5oIcfnU2yvO |
JSON |
---|
http://api.unroole.com/channels/1/collections.json?token=1f0qpLwoV5oIcfnU2yvO |
|
XML |
---|
http://api.unroole.com/channels/1/collections.xml?token=1f0qpLwoV5oIcfnU2yvO |
|
Search for 'test' returning all fields
Parameters | Values |
---|---|
token | 1f0qpLwoV5oIcfnU2yvO |
search | test |
fields | id,name,description,activate_at,deactivate_at,active,disable_deactivation,slideshow,rotation_speed,updated_at,created_at,items |
JSON |
---|
http://api.unroole.com/channels/1/collections.json?token=1f0qpLwoV5oIcfnU2yvO&search=test&fields=id,name,description,activate_at,deactivate_at,active,disable_deactivation,slideshow,rotation_speed,updated_at,created_at,items |
|
XML |
---|
http://api.unroole.com/channels/1/collections.xml?token=1f0qpLwoV5oIcfnU2yvO&search=test&fields=id,name,description,activate_at,deactivate_at,active,disable_deactivation,slideshow,rotation_speed,updated_at,created_at,items |
|
Limit to first 2 collections
result_length is 3 because there are 3 collections that can be returned, but the user requested only for 2
Parameters | Values |
---|---|
token | 1f0qpLwoV5oIcfnU2yvO |
limit | 2 |
fields | id,name |
JSON |
---|
http://api.unroole.com/channels/1/collections.json?token=1f0qpLwoV5oIcfnU2yvO&limit=2&fields=id,name |
|
XML |
---|
http://api.unroole.com/channels/1/collections.xml?token=1f0qpLwoV5oIcfnU2yvO&search=test&fields=id,name,description,activate_at,deactivate_at,active,disable_deactivation,slideshow,rotation_speed,updated_at,created_at,items |
|