Accounts:GET
(Difference between revisions)
(→Paginated request when more then one account is returned) |
Mike.robski (Talk | contribs) m (1 revision: Release 90) |
Revision as of 12:23, 31 January 2014
GET /accounts
Retrieves a list of all accounts authorized for access with the provided credentials.
Contents |
Request
GET /accounts
URI Parameters
- filterStatus - string
- Optional. Only accounts with status matching the value of the parameter will be returned. Allowed values are pending, open, suspended, closed.
- page - integer
- Optional. Specifies which page should be displayed. Requires a pageSize parameter to also be provided.
- pageSize - integer
- Optional. Specifies the number of entries to be displayed on a page. Default size is 100. Requires a page parameter to also be provided.
Request Headers
- Authorization - HTTP Authorization header [1]
- The Authentication credentials of the client application.
Response
Status Code
- 200 OK
- Success
- 400 Bad Request
- 401 Unauthorized
- The supplied credentials are invalid or do not provide permissions for this operation.
- 403 Forbidden
- Forbidden access to a user not authorized for such access.
- 415 Unsupported Media Type
- The Content-Type header was not specified or the specified type is not supported. Use application/json.
Response Body
{ "list" : [{ "status" : "{status}", "links" : [{ "href" : "https://api.hostway.com/accounts/{account-number}/", "rel" : "self" }], "accountNumber" : "{account-number}" }], "links" : [{ "href" : "https://api.hostway.com/accounts?pageSize={pageSize}&page={page}", "rel" : "self" }, { "href" : "https://api.hostway.com/accounts?pageSize={pageSize}&page={page}", "rel" : "next" }, { "href" : "https://api.hostway.com/accounts?pageSize={pageSize}&page={page}", "rel" : "last" }] }
Parameters
- list - list
- A collection of dictionaries containing information about specific account
- status - string
- Describes the status of the account. Valid values are pending, open, suspended, closed
- accountNumber - string
- The Id of the account
- links - list
- Hypermedia for this account resource. Links to the account.
- links - list
- Hypermedia Link to self and other resources relevant to the account lists
Examples
Listing current account only when provided credentials don't give elevated access
Request
GET /accounts
Response
{ "list": [{ "status": "open", "links": [{ "href": "https://api.hostway.com/accounts/test-account/", "rel": "self" }], "accountNumber": "test-account" }], "links": [{ "href": "https://api.hostway.com/accounts", "rel": "self" }] }
Paginated request when more then one account is returned
Request
GET /accounts?pageSize=2&page=1
Response
{ "list" : [{ "status" : "open", "links" : [{ "href" : "https://api.hostway.com/accounts/test-account-1/", "rel" : "self" }], "accountNumber" : "test-account-1" }, "status" : "closed", "links" : [{ "href" : "https://api.hostway.com/accounts/test-account-2/", "rel" : "self" }], "accountNumber" : "test-account-2" }], "links" : [{ "href" : "https://api.hostway.com/accounts?pageSize=2&page=1", "rel" : "self" }, { "href" : "https://api.hostway.com?pageSize=2&page=2", "rel" : "next" }, { "href" : "https://api.hostway.com?pageSize=2&page=11637", "rel" : "last" }] }
See also