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)  | 
		
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