Accounts:GET
From Hostway API Documentation
(Difference between revisions)
(→Paginated request when more then one account is returned) |
Mike.robski (Talk | contribs) m (1 revision: Release 101) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 45: | Line 45: | ||
"rel" : "self" | "rel" : "self" | ||
}], | }], | ||
− | "accountNumber" : "{account-number}" | + | "accountNumber" : "{account-number}", |
+ | "createdDate" : "{created-date}", | ||
+ | "currency": "{currency}" | ||
}], | }], | ||
"links" : [{ | "links" : [{ | ||
Line 71: | Line 73: | ||
:; accountNumber - ''string'' | :; accountNumber - ''string'' | ||
:: The Id of the account | :: The Id of the account | ||
+ | |||
+ | :; createdDate - ''date'' | ||
+ | :: The date account was created in format Y-m-d | ||
+ | |||
+ | :; currency - ''string'' | ||
+ | :: An ISO-4217[http://www.iso.org/iso/home/standards/currency_codes.htm] currency code assigned to the account. | ||
:; links - ''list'' | :; links - ''list'' | ||
Line 77: | Line 85: | ||
; links - ''list'' | ; links - ''list'' | ||
: [[Hypermedia]] Link to self and other resources relevant to the account lists | : [[Hypermedia]] Link to self and other resources relevant to the account lists | ||
− | |||
== Examples == | == Examples == | ||
Line 96: | Line 103: | ||
"rel": "self" | "rel": "self" | ||
}], | }], | ||
− | "accountNumber": "test-account" | + | "accountNumber": "test-account", |
+ | "createdDate": "2009-12-07", | ||
+ | "currency": "USD" | ||
}], | }], | ||
"links": [{ | "links": [{ | ||
Line 104: | Line 113: | ||
} | } | ||
</nowiki> | </nowiki> | ||
− | |||
=== Paginated request when more then one account is returned === | === Paginated request when more then one account is returned === | ||
Line 121: | Line 129: | ||
"rel" : "self" | "rel" : "self" | ||
}], | }], | ||
− | "accountNumber" : "test-account-1" | + | "accountNumber" : "test-account-1", |
+ | "createdDate": "2009-12-07", | ||
+ | "currency": "USD" | ||
}, | }, | ||
"status" : "closed", | "status" : "closed", | ||
Line 128: | Line 138: | ||
"rel" : "self" | "rel" : "self" | ||
}], | }], | ||
− | "accountNumber" : "test-account-2" | + | "accountNumber" : "test-account-2", |
+ | "createdDate": "20012-11-01", | ||
+ | "currency": "CAD" | ||
}], | }], | ||
"links" : [{ | "links" : [{ |
Latest revision as of 22:49, 16 December 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}", "createdDate" : "{created-date}", "currency": "{currency}" }], "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
- createdDate - date
- The date account was created in format Y-m-d
- currency - string
- An ISO-4217[2] currency code assigned to 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", "createdDate": "2009-12-07", "currency": "USD" }], "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", "createdDate": "2009-12-07", "currency": "USD" }, "status" : "closed", "links" : [{ "href" : "https://api.hostway.com/accounts/test-account-2/", "rel" : "self" }], "accountNumber" : "test-account-2", "createdDate": "20012-11-01", "currency": "CAD" }], "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