Difference between revisions of "API Channels List"
Tommy.leung (Talk | contribs) (→Response) |
|||
(12 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
== Summary == | == Summary == | ||
− | Allows querying for a list of channels belonging to the account. | + | Allows querying for a list of channels belonging to the account. The query is a wildcard search on: |
+ | * name | ||
+ | * type | ||
== URI == | == URI == | ||
− | {{:API_Base_URI}}[account-id]/channels | + | {{:API_Base_URI}}accounts/[account-id]/channels |
== HTTP Method == | == HTTP Method == | ||
Line 38: | Line 40: | ||
|- | |- | ||
| limit | | limit | ||
− | | | + | | 100 |
| | | | ||
| | | | ||
| The maximum number of channels to return. | | The maximum number of channels to return. | ||
+ | |- | ||
+ | | fields | ||
+ | | id, name, type, url, logo_url | ||
+ | | | ||
+ | | [[API Channel Fields]] | ||
+ | | List of comma separated fields to be returned in the response. | ||
+ | |- | ||
+ | | page | ||
+ | | 1 | ||
+ | | Depends on query | ||
+ | | Integer | ||
+ | | The current pages to display based on the limit. | ||
|- | |- | ||
| url_time_limit | | url_time_limit | ||
Line 47: | Line 61: | ||
| | | | ||
| | | | ||
− | | The length of time (in seconds) that the | + | | The length of time (in seconds) that the asset url will be accessible for. This only applies to the response. |
|} | |} | ||
Line 62: | Line 76: | ||
| array of [[API Channel Fields]] | | array of [[API Channel Fields]] | ||
| List of channels | | List of channels | ||
+ | |- | ||
+ | | 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. |
+ | |} | ||
+ | |||
+ | == Examples == | ||
+ | |||
+ | === All channels on the account accessible by the user === | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Parameters | ||
+ | ! Values | ||
+ | |- | ||
+ | | token | ||
+ | | 1f0qpLwoV5oIcfnU2yvO | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! JSON | ||
+ | |- | ||
+ | | <nowiki>http://api.unroole.com/accounts/2/channels.json?token=1f0qpLwoV5oIcfnU2yvO</nowiki> | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | { | ||
+ | "channels" : [ | ||
+ | { "id" : 5, | ||
+ | "logo_url" : <nowiki>"https://cdn-unroole-dev.s3.amazonaws.com/system/channels/logos/5/original/opo9941a.jpg"</nowiki>, | ||
+ | "name" : "another sample channel", | ||
+ | "type" : "Mobile Briefcase", | ||
+ | "url" : <nowiki>"http://anothersamplechannel-sample.unroole.com"</nowiki> | ||
+ | }, | ||
+ | { "id" : 4, | ||
+ | "logo_url" : <nowiki>"https://cdn-unroole-dev.s3.amazonaws.com/system/channels/logos/4/original/heic0709b.jpg"</nowiki>, | ||
+ | "name" : "samplechannel", | ||
+ | "type" : "Mobile Briefcase", | ||
+ | "url" : <nowiki>"http://samplechannel-sample.unroole.com"</nowiki> | ||
+ | } | ||
+ | ], | ||
+ | "http_status" : 200, | ||
+ | “page” : 1, | ||
+ | “per-page” : 100, | ||
+ | “total-pages” : 1 | ||
+ | “total-entries” : 2, | ||
+ | “result_length” : 2 | ||
+ | } | ||
+ | </blockquote> | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! XML | ||
+ | |- | ||
+ | | <nowiki>http://api.unroole.com/accounts/2/channels.xml?token=1f0qpLwoV5oIcfnU2yvO</nowiki> | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | <hash> | ||
+ | <channels type="array"> | ||
+ | <channel> | ||
+ | <id type="integer">5</id> | ||
+ | <name>another sample channel</name> | ||
+ | <type>Mobile Briefcase</type> | ||
+ | <url><nowiki>http://anothersamplechannel-sample.unroole.com</nowiki></url> | ||
+ | <logo-url><nowiki>https://cdn-unroole-dev.s3.amazonaws.com/system/channels/logos/5/original/opo9941a.jpg</nowiki></logo-url> | ||
+ | </channel> | ||
+ | <channel> | ||
+ | <id type="integer">4</id> | ||
+ | <name>samplechannel</name> | ||
+ | <type>Mobile Briefcase</type> | ||
+ | <url><nowiki>http://samplechannel-sample.unroole.com</nowiki></url> | ||
+ | <logo-url><nowiki>https://cdn-unroole-dev.s3.amazonaws.com/system/channels/logos/4/original/heic0709b.jpg</nowiki></logo-url> | ||
+ | </channel> | ||
+ | </channels> | ||
+ | <page type="integer">1</page> | ||
+ | <per-page” type="integer">100</per-page”> | ||
+ | <total-pages type="integer">1</total-pages> | ||
+ | <total-entries type="integer">2</total-entries> | ||
+ | <result-length type="integer">2</result-length> | ||
+ | <http-status type="integer">200</http-status> | ||
+ | </hash> | ||
+ | </blockquote> | ||
+ | |} | ||
+ | |||
+ | === All channels on the account accessible by the user, returning all fields === | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Parameters | ||
+ | ! Values | ||
+ | |- | ||
+ | | token | ||
+ | | 1f0qpLwoV5oIcfnU2yvO | ||
+ | |- | ||
+ | | fields | ||
+ | | id,name,url,logo_url,type,updated_at,created_at | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! JSON | ||
+ | |- | ||
+ | | <nowiki>http://api.unroole.com/accounts/1/channels.json?token=1f0qpLwoV5oIcfnU2yvO&fields=id,name,url,logo_url,type,updated_at,created_at</nowiki> | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | { "channels" : [ | ||
+ | { "created_at" : "2012-06-14T17:47:31Z", | ||
+ | "id" : 1, | ||
+ | "logo_url" : <nowiki>"https://cdn-unroole-dev.s3.amazonaws.com/system/channels/logos/1/original/opo0501a.jpg"</nowiki>, | ||
+ | "name" : "testchannel", | ||
+ | "type" : "Mobile Briefcase", | ||
+ | "updated_at" : "2012-06-14T17:47:31Z", | ||
+ | "url" : <nowiki>"http://testchannel-testaccount.unroole.com"</nowiki> | ||
+ | }, | ||
+ | { "created_at" : "2012-06-15T19:24:15Z", | ||
+ | "id" : 2, | ||
+ | "logo_url" : <nowiki>"https://cdn-unroole-dev.s3.amazonaws.com/system/channels/logos/2/original/opo0110a.jpg"</nowiki>, | ||
+ | "name" : "testchannel2", | ||
+ | "type" : "Mobile Briefcase", | ||
+ | "updated_at" : "2012-06-15T19:24:15Z", | ||
+ | "url" : <nowiki>"http://testchannel2-testaccount.unroole.com"</nowiki> | ||
+ | }, | ||
+ | { "created_at" : "2012-06-15T19:24:57Z", | ||
+ | "id" : 3, | ||
+ | "logo_url" : <nowiki>"https://cdn-unroole-dev.s3.amazonaws.com/system/channels/logos/3/original/opo9912a.jpg"</nowiki>, | ||
+ | "name" : "testchannel3", | ||
+ | "type" : "Mobile Briefcase", | ||
+ | "updated_at" : "2012-06-15T19:24:57Z", | ||
+ | "url" : <nowiki>"http://testchannel3-testaccount.unroole.com"</nowiki> | ||
+ | }, | ||
+ | { "created_at" : "2012-06-18T13:22:36Z", | ||
+ | "id" : 7, | ||
+ | "logo_url" : <nowiki>"https://cdn-unroole-dev.s3.amazonaws.com/system/channels/logos/7/original/qrcode.234073.png"</nowiki>, | ||
+ | "name" : "promotions", | ||
+ | "type" : "Website", | ||
+ | "updated_at" : "2012-06-18T13:22:36Z", | ||
+ | "url" : <nowiki>"http://promotions-testaccount.unroole.com"</nowiki> | ||
+ | } | ||
+ | ], | ||
+ | "http_status" : 200, | ||
+ | “page” : 1, | ||
+ | “per-page” : 100, | ||
+ | “total-pages” : 1 | ||
+ | “total-entries” : 4, | ||
+ | “result_length” : 4 | ||
+ | } | ||
+ | </blockquote> | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! XML | ||
+ | |- | ||
+ | | <nowiki>http://api.unroole.com/accounts/1/channels.xml?token=1f0qpLwoV5oIcfnU2yvO&fields=id,name,url,logo_url,type,updated_at,created_at</nowiki> | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | <hash> | ||
+ | <channels type="array"> | ||
+ | <channel> | ||
+ | <id type="integer">1</id> | ||
+ | <name>testchannel</name> | ||
+ | <type>Mobile Briefcase</type> | ||
+ | <url><nowiki>http://testchannel-testaccount.unroole.com</nowiki></url> | ||
+ | <logo-url><nowiki>https://cdn-unroole-dev.s3.amazonaws.com/system/channels/logos/1/original/opo0501a.jpg</nowiki></logo-url> | ||
+ | <created-at type="datetime">2012-06-14T17:47:31Z</created-at> | ||
+ | <updated-at type="datetime">2012-06-14T17:47:31Z</updated-at> | ||
+ | </channel> | ||
+ | <channel> | ||
+ | <id type="integer">2</id> | ||
+ | <name>testchannel2</name> | ||
+ | <type>Mobile Briefcase</type> | ||
+ | <url><nowiki>http://testchannel2-testaccount.unroole.com</nowiki></url> | ||
+ | <logo-url><nowiki>https://cdn-unroole-dev.s3.amazonaws.com/system/channels/logos/2/original/opo0110a.jpg</nowiki></logo-url> | ||
+ | <created-at type="datetime">2012-06-15T19:24:15Z</created-at> | ||
+ | <updated-at type="datetime">2012-06-15T19:24:15Z</updated-at> | ||
+ | </channel> | ||
+ | <channel> | ||
+ | <id type="integer">3</id> | ||
+ | <name>testchannel3</name> | ||
+ | <type>Mobile Briefcase</type> | ||
+ | <url><nowiki>http://testchannel3-testaccount.unroole.com</nowiki></url> | ||
+ | <logo-url><nowiki>https://cdn-unroole-dev.s3.amazonaws.com/system/channels/logos/3/original/opo9912a.jpg</nowiki></logo-url> | ||
+ | <created-at type="datetime">2012-06-15T19:24:57Z</created-at> | ||
+ | <updated-at type="datetime">2012-06-15T19:24:57Z</updated-at> | ||
+ | </channel> | ||
+ | <channel> | ||
+ | <id type="integer">7</id> | ||
+ | <name>promotions</name> | ||
+ | <type>Website</type> | ||
+ | <url><nowiki>http://promotions-testaccount.unroole.com</nowiki></url> | ||
+ | <logo-url><nowiki>https://cdn-unroole-dev.s3.amazonaws.com/system/channels/logos/7/original/qrcode.234073.png</nowiki></logo-url> | ||
+ | <created-at type="datetime">2012-06-18T13:22:36Z</created-at> | ||
+ | <updated-at type="datetime">2012-06-18T13:22:36Z</updated-at> | ||
+ | </channel> | ||
+ | </channels> | ||
+ | <page type="integer">1</page> | ||
+ | <per-page” type="integer">100</per-page”> | ||
+ | <total-pages type="integer">1</total-pages> | ||
+ | <total-entries type="integer">4</total-entries> | ||
+ | <result-length type="integer">4</result-length> | ||
+ | <http-status type="integer">200</http-status> | ||
+ | </hash> | ||
+ | </blockquote> | ||
+ | |} | ||
+ | |||
+ | === Return 2 results using search term "test" === | ||
+ | |||
+ | ''result_length is 3 because there are 3 channels that can be returned, but the user requested only for 2'' | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Parameters | ||
+ | ! Values | ||
+ | |- | ||
+ | | token | ||
+ | | 1f0qpLwoV5oIcfnU2yvO | ||
+ | |- | ||
+ | | limit | ||
+ | | 2 | ||
+ | |- | ||
+ | | search | ||
+ | | test | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! JSON | ||
+ | |- | ||
+ | | <nowiki>http://api.unroole.com/accounts/1/channels.json?token=1f0qpLwoV5oIcfnU2yvO&limit=2&search=test</nowiki> | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | { "channels" : [ | ||
+ | { "id" : 1, | ||
+ | "logo_url" : <nowiki>"https://cdn-unroole-dev.s3.amazonaws.com/system/channels/logos/1/original/opo0501a.jpg"</nowiki>, | ||
+ | "name" : "testchannel", | ||
+ | "type" : "Mobile Briefcase", | ||
+ | "url" : <nowiki>"http://testchannel-testaccount.unroole.com"</nowiki> | ||
+ | }, | ||
+ | { "id" : 2, | ||
+ | "logo_url" : <nowiki>"https://cdn-unroole-dev.s3.amazonaws.com/system/channels/logos/2/original/opo0110a.jpg"</nowiki>, | ||
+ | "name" : "testchannel2", | ||
+ | "type" : "Mobile Briefcase", | ||
+ | "url" : <nowiki>"http://testchannel2-testaccount.unroole.com"</nowiki> | ||
+ | } | ||
+ | ], | ||
+ | "http_status" : 200, | ||
+ | “page” : 1, | ||
+ | “per-page” : 2, | ||
+ | “total-pages” : 2 | ||
+ | “total-entries” : 4, | ||
+ | “result_length” : 2 | ||
+ | } | ||
+ | </blockquote> | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! XML | ||
+ | |- | ||
+ | | <nowiki>http://api.unroole.com/accounts/1/channels.xml?token=1f0qpLwoV5oIcfnU2yvO&limit=2&search=test</nowiki> | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | <hash> | ||
+ | <channels type="array"> | ||
+ | <channel> | ||
+ | <id type="integer">1</id> | ||
+ | <name>testchannel</name> | ||
+ | <type>Mobile Briefcase</type> | ||
+ | <url><nowiki>http://testchannel-testaccount.unroole.com</nowiki></url> | ||
+ | <logo-url><nowiki>https://cdn-unroole-dev.s3.amazonaws.com/system/channels/logos/1/original/opo0501a.jpg</nowiki></logo-url> | ||
+ | </channel> | ||
+ | <channel> | ||
+ | <id type="integer">2</id> | ||
+ | <name>testchannel2</name> | ||
+ | <type>Mobile Briefcase</type> | ||
+ | <url><nowiki>http://testchannel2-testaccount.unroole.com</nowiki></url> | ||
+ | <logo-url><nowiki>https://cdn-unroole-dev.s3.amazonaws.com/system/channels/logos/2/original/opo0110a.jpg</nowiki></logo-url> | ||
+ | </channel> | ||
+ | </channels> | ||
+ | <page type="integer">1</page> | ||
+ | <per-page” type="integer">2</per-page”> | ||
+ | <total-pages type="integer">2</total-pages> | ||
+ | <total-entries type="integer">4</total-entries> | ||
+ | <result-length type="integer">2</result-length> | ||
+ | <http-status type="integer">200</http-status> | ||
+ | </hash> | ||
+ | </blockquote> | ||
+ | |} | ||
+ | |||
+ | === Search for type "Website" === | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Parameters | ||
+ | ! Values | ||
+ | |- | ||
+ | | token | ||
+ | | 1f0qpLwoV5oIcfnU2yvO | ||
+ | |- | ||
+ | | search | ||
+ | | Website | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! JSON | ||
+ | |- | ||
+ | | <nowiki>http://api.unroole.com/accounts/1/channels.json?token=1f0qpLwoV5oIcfnU2yvO&search=Website</nowiki> | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | { "channels" : [ | ||
+ | { "id" : 7, | ||
+ | "logo_url" : <nowiki>"https://cdn-unroole-dev.s3.amazonaws.com/system/channels/logos/7/original/qrcode.234073.png"</nowiki>, | ||
+ | "name" : "promotions", | ||
+ | "type" : "Website", | ||
+ | "url" : <nowiki>"http://promotions-testaccount.unroole.com"</nowiki> | ||
+ | } ], | ||
+ | "http_status" : 200, | ||
+ | “page” : 1, | ||
+ | “per-page” : 100, | ||
+ | “total-pages” : 1 | ||
+ | “total-entries” : 1, | ||
+ | “result_length” : 1 | ||
+ | } | ||
+ | </blockquote> | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! XML | ||
+ | |- | ||
+ | | <nowiki>http://api.unroole.com/accounts/1/channels.xml?token=1f0qpLwoV5oIcfnU2yvO&search=Website</nowiki> | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | <hash> | ||
+ | <channels type="array"> | ||
+ | <channel> | ||
+ | <id type="integer">7</id> | ||
+ | <name>promotions</name> | ||
+ | <type>Website</type> | ||
+ | <url><nowiki>http://promotions-testaccount.unroole.com</nowiki></url> | ||
+ | <logo-url><nowiki>https://cdn-unroole-dev.s3.amazonaws.com/system/channels/logos/7/original/qrcode.234073.png</nowiki></logo-url> | ||
+ | </channel> | ||
+ | </channels> | ||
+ | <page type="integer">1</page> | ||
+ | <per-page” type="integer">100</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> | ||
+ | </blockquote> | ||
|} | |} |
Latest revision as of 10:00, 29 November 2013
Contents
Summary
Allows querying for a list of channels belonging to the account. The query is a wildcard search on:
- name
- type
URI
https://api.unroole.com/accounts/[account-id]/channels
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 | 100 | The maximum number of channels to return. | ||
fields | id, name, type, url, logo_url | API Channel Fields | List of comma separated fields to be returned in the response. | |
page | 1 | Depends on query | Integer | The current pages to display based on the limit. |
url_time_limit | 60 | The length of time (in seconds) that the asset url will be accessible for. This only applies to the response. |
Response
Field | Type | Description |
---|---|---|
http_status | integer | API Status Code http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html |
error | Rails default | |
accounts | array of API Channel Fields | List of channels |
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 channels on the account accessible by the user
Parameters | Values |
---|---|
token | 1f0qpLwoV5oIcfnU2yvO |
JSON |
---|
http://api.unroole.com/accounts/2/channels.json?token=1f0qpLwoV5oIcfnU2yvO |
|
XML |
---|
http://api.unroole.com/accounts/2/channels.xml?token=1f0qpLwoV5oIcfnU2yvO |
|
All channels on the account accessible by the user, returning all fields
Parameters | Values |
---|---|
token | 1f0qpLwoV5oIcfnU2yvO |
fields | id,name,url,logo_url,type,updated_at,created_at |
JSON |
---|
http://api.unroole.com/accounts/1/channels.json?token=1f0qpLwoV5oIcfnU2yvO&fields=id,name,url,logo_url,type,updated_at,created_at |
|
XML |
---|
http://api.unroole.com/accounts/1/channels.xml?token=1f0qpLwoV5oIcfnU2yvO&fields=id,name,url,logo_url,type,updated_at,created_at |
|
Return 2 results using search term "test"
result_length is 3 because there are 3 channels that can be returned, but the user requested only for 2
Parameters | Values |
---|---|
token | 1f0qpLwoV5oIcfnU2yvO |
limit | 2 |
search | test |
JSON |
---|
http://api.unroole.com/accounts/1/channels.json?token=1f0qpLwoV5oIcfnU2yvO&limit=2&search=test |
|
XML |
---|
http://api.unroole.com/accounts/1/channels.xml?token=1f0qpLwoV5oIcfnU2yvO&limit=2&search=test |
|
Search for type "Website"
Parameters | Values |
---|---|
token | 1f0qpLwoV5oIcfnU2yvO |
search | Website |
JSON |
---|
http://api.unroole.com/accounts/1/channels.json?token=1f0qpLwoV5oIcfnU2yvO&search=Website |
|
XML |
---|
http://api.unroole.com/accounts/1/channels.xml?token=1f0qpLwoV5oIcfnU2yvO&search=Website |
|