Difference between revisions of "API Accounts List"
Tommy.leung (Talk | contribs) |
Tommy.leung (Talk | contribs) |
||
Line 162: | Line 162: | ||
<http-status type="integer">200</http-status> | <http-status type="integer">200</http-status> | ||
</hash> | </hash> | ||
+ | |||
+ | </blockquote> | ||
+ | |} | ||
+ | |||
+ | === Limit 1 account and set the fields returned === | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Parameters | ||
+ | ! Values | ||
+ | |- | ||
+ | | token | ||
+ | | 1f0qpLwoV5oIcfnU2yvO | ||
+ | |- | ||
+ | | limit | ||
+ | | 1 | ||
+ | |- | ||
+ | | fields | ||
+ | | id,url,updated_at | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! JSON | ||
+ | |- | ||
+ | | <nowiki>http://api.unroole.com:3000/accounts.json?token=1f0qpLwoV5oIcfnU2yvO&limit=1&fields=id,url,updated_at</nowiki> | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | { | ||
+ | "accounts" : [ | ||
+ | { "id" : 1, | ||
+ | "updated_at" : "2012-06-14T17:46:10Z", | ||
+ | "url" : <nowiki>"http://testaccount.unroole.com"</nowiki> | ||
+ | } ], | ||
+ | "http_status" : 200, | ||
+ | "result_length" : 4 | ||
+ | } | ||
+ | </blockquote> | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! XML | ||
+ | |- | ||
+ | | <nowiki>http://api.unroole.com:3000/accounts.xml?token=1f0qpLwoV5oIcfnU2yvO&limit=1&fields=id,url,updated_at</nowiki> | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | <hash> | ||
+ | <accounts type="array"> | ||
+ | <account> | ||
+ | <id type="integer">1</id> | ||
+ | <url><nowiki>http://testaccount.unroole.com</nowiki></url> | ||
+ | <updated-at type="datetime">2012-06-14T17:46:10Z</updated-at> | ||
+ | </account> | ||
+ | </accounts> | ||
+ | <result-length type="integer">4</result-length> | ||
+ | <http-status type="integer">200</http-status> | ||
+ | </hash> | ||
+ | |||
</blockquote> | </blockquote> | ||
|} | |} |
Revision as of 14:57, 15 June 2012
Contents
Summary
Allows querying for a list of accounts belonging to the user. The query is a wildcard search on:
- name
URI
https://api.unroole.com/accounts
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 accounts to return. | ||
fields | id, name, url, logo_url | API Account Fields | List of comma separated fields to be returned in the response. | |
url_time_limit | 60 | The length of time (in seconds) that the logo 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 Account Fields | List of accounts |
result_length | integer | Total number of results that could be returned. This may not be the number of accounts in the response, as it is truncated by limit parameter. |
Examples
Examples
All accounts accessible by the user
Parameters | Values |
---|---|
token | 1f0qpLwoV5oIcfnU2yvO |
JSON |
---|
http://api.unroole.com/accounts.json?token=1f0qpLwoV5oIcfnU2yvO |
|
XML |
---|
http://api.unroole.com/accounts.xml?token=1f0qpLwoV5oIcfnU2yvO |
|
Limit 1 account and set the fields returned
Parameters | Values |
---|---|
token | 1f0qpLwoV5oIcfnU2yvO |
limit | 1 |
fields | id,url,updated_at |
JSON |
---|
http://api.unroole.com:3000/accounts.json?token=1f0qpLwoV5oIcfnU2yvO&limit=1&fields=id,url,updated_at |
|
XML |
---|
http://api.unroole.com:3000/accounts.xml?token=1f0qpLwoV5oIcfnU2yvO&limit=1&fields=id,url,updated_at |
|