Difference between revisions of "API Channels List"

From unroole CMS wiki
Jump to: navigation, search
(Examples)
(Examples)
Line 255: Line 255:
 
   </channels>
 
   </channels>
 
   <result-length type="integer">4</result-length>
 
   <result-length type="integer">4</result-length>
 +
  <http-status type="integer">200</http-status>
 +
</hash>
 +
</blockquote>
 +
|}
 +
 +
=== Return 2 results using search term "test" ===
 +
 +
''result_limit 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,
 +
  "result_length" : 3
 +
}
 +
</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>
 +
  <result-length type="integer">3</result-length>
 
   <http-status type="integer">200</http-status>
 
   <http-status type="integer">200</http-status>
 
  </hash>
 
  </hash>
 
</blockquote>
 
</blockquote>
 
|}
 
|}

Revision as of 10:57, 18 June 2012

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 TBD 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.
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
result_length integer Total number of results that could be returned. This may not be the number of channels in the response, as it is truncated by limit parameter.

Examples

All channels on the account accessible by the user

Parameters Values
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

Return 2 results using search term "test"

result_limit 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