Difference between revisions of "API Collections List"
Tommy.leung (Talk | contribs) |
|||
(9 intermediate revisions by 3 users not shown) | |||
Line 39: | Line 39: | ||
|- | |- | ||
| limit | | limit | ||
− | | | + | | 50 |
| | | | ||
| | | | ||
| The maximum number of collections to return. | | The maximum number of collections to return. | ||
+ | |- | ||
+ | | page | ||
+ | | 1 | ||
+ | | Depends on query | ||
+ | | Integers | ||
+ | | The current pages to display based on the limit. | ||
|- | |- | ||
| fields | | fields | ||
Line 63: | Line 69: | ||
| array of [[API Collection Fields]] | | array of [[API Collection Fields]] | ||
| List of collections | | List of collections | ||
+ | |- | ||
+ | | page | ||
+ | | integer | ||
+ | | The current viewed page of results. | ||
+ | |- | ||
+ | | per-page | ||
+ | | integer | ||
+ | | The maximum number of results to return per page. | ||
+ | |- | ||
+ | | total-pages | ||
+ | | integer | ||
+ | | The total number of pages that exist. | ||
+ | |- | ||
+ | | total-entries | ||
+ | | integer | ||
+ | | The total number of entries found from all pages. | ||
|- | |- | ||
| result_length | | result_length | ||
| integer | | integer | ||
− | | Total number of results that | + | | Total number of results that have been returned on this page. This may differ from the per-page/limit value on the last page. |
|} | |} | ||
Line 90: | Line 112: | ||
| <blockquote> | | <blockquote> | ||
<nowiki> | <nowiki> | ||
− | { " | + | { "collections" : [ { "id" : 1, |
"items" : [ { "editable" : true, | "items" : [ { "editable" : true, | ||
"id" : 2, | "id" : 2, | ||
Line 208: | Line 230: | ||
} | } | ||
], | ], | ||
− | + | “page” : 1, | |
− | " | + | “per-page” : 50, |
+ | “total-pages” : 1, | ||
+ | “total-entries” : 3, | ||
+ | “result_length” : 3, | ||
+ | "http_status" : 200 | ||
} | } | ||
</nowiki> | </nowiki> | ||
Line 225: | Line 251: | ||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||
<hash> | <hash> | ||
− | < | + | <collections type="array"> |
<collection> | <collection> | ||
<id type="integer">1</id> | <id type="integer">1</id> | ||
Line 362: | Line 388: | ||
<name>blank collection</name> | <name>blank collection</name> | ||
<items type="array"/> | <items type="array"/> | ||
− | </collection></ | + | </collection> |
− | + | </collections> | |
− | <http-status type="integer">200</http-status> | + | <page type="integer">1</page> |
− | </hash> | + | <per-page” type="integer">50</per-page”> |
+ | <total-pages type="integer">1</total-pages> | ||
+ | <total-entries type="integer">3</total-entries> | ||
+ | <result-length type="integer">3</result-length> | ||
+ | <http-status type="integer">200</http-status> | ||
+ | </hash> | ||
+ | </nowiki> | ||
+ | </blockquote> | ||
+ | |} | ||
+ | |||
+ | === Search for 'test' returning all fields === | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! 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 | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! JSON | ||
+ | |- | ||
+ | | <nowiki>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</nowiki> | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | <nowiki> | ||
+ | { "collections" : [ { "active" : true, | ||
+ | "created_at" : "2012-06-26T13:13:15Z", | ||
+ | "deactivate_at" : "2017-06-26", | ||
+ | "description" : "this is the sample description", | ||
+ | "id" : 1, | ||
+ | "items" : [ { "editable" : true, | ||
+ | "id" : 2, | ||
+ | "item_id" : 302, | ||
+ | "printable" : true, | ||
+ | "shareable" : false, | ||
+ | "type" : "Pdf" | ||
+ | }, | ||
+ | { "editable" : false, | ||
+ | "id" : 5, | ||
+ | "item_id" : 299, | ||
+ | "printable" : false, | ||
+ | "shareable" : false, | ||
+ | "type" : "Document" | ||
+ | }, | ||
+ | { "editable" : false, | ||
+ | "id" : 7, | ||
+ | "item_id" : 107, | ||
+ | "printable" : false, | ||
+ | "shareable" : false, | ||
+ | "type" : "Video" | ||
+ | }, | ||
+ | { "editable" : false, | ||
+ | "id" : 3, | ||
+ | "item_id" : 301, | ||
+ | "printable" : false, | ||
+ | "shareable" : true, | ||
+ | "type" : "Document" | ||
+ | }, | ||
+ | { "editable" : false, | ||
+ | "id" : 4, | ||
+ | "item_id" : 300, | ||
+ | "printable" : true, | ||
+ | "shareable" : false, | ||
+ | "type" : "Pdf" | ||
+ | }, | ||
+ | { "editable" : true, | ||
+ | "id" : 1, | ||
+ | "item_id" : 303, | ||
+ | "printable" : true, | ||
+ | "shareable" : true, | ||
+ | "type" : "Image" | ||
+ | }, | ||
+ | { "editable" : false, | ||
+ | "id" : 6, | ||
+ | "item_id" : 108, | ||
+ | "printable" : false, | ||
+ | "shareable" : false, | ||
+ | "type" : "Video" | ||
+ | } | ||
+ | ], | ||
+ | "name" : "test collection", | ||
+ | "rotation_speed" : 4, | ||
+ | "slideshow" : true, | ||
+ | "updated_at" : "2012-06-26T13:13:15Z" | ||
+ | } ], | ||
+ | “page” : 1, | ||
+ | “per-page” : 50, | ||
+ | “total-pages” : 1, | ||
+ | “total-entries” : 1, | ||
+ | “result_length” : 1, | ||
+ | "http_status" : 200 | ||
+ | } | ||
+ | </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> | ||
+ | <collections type="array"> | ||
+ | <collection> | ||
+ | <id type="integer">1</id> | ||
+ | <name>test collection</name> | ||
+ | <description>this is the sample description</description> | ||
+ | <updated-at type="datetime">2012-06-26T13:13:15Z</updated-at> | ||
+ | <created-at type="datetime">2012-06-26T13:13:15Z</created-at> | ||
+ | <deactivate-at type="date">2017-06-26</deactivate-at> | ||
+ | <active type="boolean">true</active> | ||
+ | <slideshow type="boolean">true</slideshow> | ||
+ | <rotation-speed type="integer">4</rotation-speed> | ||
+ | <items type="array"> | ||
+ | <item> | ||
+ | <id type="integer">2</id> | ||
+ | <item-id type="integer">302</item-id> | ||
+ | <type>Pdf</type> | ||
+ | <shareable type="boolean">false</shareable> | ||
+ | <editable type="boolean">true</editable> | ||
+ | <printable type="boolean">true</printable> | ||
+ | </item> | ||
+ | <item> | ||
+ | <id type="integer">5</id> | ||
+ | <item-id type="integer">299</item-id> | ||
+ | <type>Document</type> | ||
+ | <shareable type="boolean">false</shareable> | ||
+ | <editable type="boolean">false</editable> | ||
+ | <printable type="boolean">false</printable> | ||
+ | </item> | ||
+ | <item> | ||
+ | <id type="integer">7</id> | ||
+ | <item-id type="integer">107</item-id> | ||
+ | <type>Video</type> | ||
+ | <shareable type="boolean">false</shareable> | ||
+ | <editable type="boolean">false</editable> | ||
+ | <printable type="boolean">false</printable> | ||
+ | </item> | ||
+ | <item> | ||
+ | <id type="integer">3</id> | ||
+ | <item-id type="integer">301</item-id> | ||
+ | <type>Document</type> | ||
+ | <shareable type="boolean">true</shareable> | ||
+ | <editable type="boolean">false</editable> | ||
+ | <printable type="boolean">false</printable> | ||
+ | </item> | ||
+ | <item> | ||
+ | <id type="integer">4</id> | ||
+ | <item-id type="integer">300</item-id> | ||
+ | <type>Pdf</type> | ||
+ | <shareable type="boolean">false</shareable> | ||
+ | <editable type="boolean">false</editable> | ||
+ | <printable type="boolean">true</printable> | ||
+ | </item> | ||
+ | <item> | ||
+ | <id type="integer">1</id> | ||
+ | <item-id type="integer">303</item-id> | ||
+ | <type>Image</type> | ||
+ | <shareable type="boolean">true</shareable> | ||
+ | <editable type="boolean">true</editable> | ||
+ | <printable type="boolean">true</printable> | ||
+ | </item> | ||
+ | <item> | ||
+ | <id type="integer">6</id> | ||
+ | <item-id type="integer">108</item-id> | ||
+ | <type>Video</type> | ||
+ | <shareable type="boolean">false</shareable> | ||
+ | <editable type="boolean">false</editable> | ||
+ | <printable type="boolean">false</printable> | ||
+ | </item> | ||
+ | </items> | ||
+ | </collection> | ||
+ | </collections> | ||
+ | <page type="integer">1</page> | ||
+ | <per-page” type="integer">50</per-page”> | ||
+ | <total-pages type="integer">1</total-pages> | ||
+ | <total-entries type="integer">1</total-entries> | ||
+ | <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> | ||
+ | { "collections" : [ { "id" : 1, | ||
+ | "name" : "test collection" | ||
+ | }, | ||
+ | { "id" : 2, | ||
+ | "name" : "another collection" | ||
+ | } | ||
+ | ], | ||
+ | “page” : 1, | ||
+ | “per-page” : 2, | ||
+ | “total-pages” : 2, | ||
+ | “total-entries” : 3, | ||
+ | “result_length” : 2, | ||
+ | "http_status" : 200 | ||
+ | } | ||
+ | </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> | ||
+ | <collections type="array"> | ||
+ | <collection> | ||
+ | <id type="integer">1</id> | ||
+ | <name>test collection</name> | ||
+ | </collection> | ||
+ | <collection> | ||
+ | <id type="integer">2</id> | ||
+ | <name>another collection</name> | ||
+ | </collection> | ||
+ | </collections> | ||
+ | <page type="integer">1</page> | ||
+ | <per-page” type="integer">2</per-page”> | ||
+ | <total-pages type="integer">2</total-pages> | ||
+ | <total-entries type="integer">3</total-entries> | ||
+ | <result-length type="integer">2</result-length> | ||
+ | <http-status type="integer">200</http-status> | ||
+ | </hash> | ||
</nowiki> | </nowiki> | ||
</blockquote> | </blockquote> | ||
|} | |} |
Latest revision as of 10:10, 29 November 2013
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 | 50 | The maximum number of collections to return. | ||
page | 1 | Depends on query | Integers | The current pages to display based on the limit. |
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 |
page | integer | The current viewed page of results. |
per-page | integer | The maximum number of results to return per page. |
total-pages | integer | The total number of pages that exist. |
total-entries | integer | The total number of entries found from all pages. |
result_length | integer | Total number of results that have been returned on this page. This may differ from the per-page/limit value on the last page. |
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 |
|