Accounts-account-dedicatedServers:GET
From Hostway API Documentation
Revision as of 10:21, 26 May 2014 by Jerry.dimitrov (Talk)
GET /accounts/{account_number}/dedicatedServers
Retrieves a list of fully provisioned dedicated servers
Contents |
Request
GET /accounts/{account_number}/dedicatedServers
GET /accounts/{account_number}/dedicatedServers?page=page&pageSize=page-size&sortField=sortField&sortOrder=sortOrder
Request Parameters
- account_number - string
- The user account owning the dedicated servers
URI Parameters
- page - integer
- Specifies which page should be displayed. Requires a pageSize parameter to also be provided.
- pageSize - integer
- Specifies the number of entries to be displayed on a page. Requires a page parameter to also be provided
- sortField - string
- Specifies if the resulting list is to be sorted by a given field. Allowed value is serverName. If the field is missing the list will be ordered by serverName.
- sortOrder - string
- The order in which the sorting is to be done. Allowed values are asc and desc. If the field is missing the order is asc.
Request Headers
- Authorization - HTTP Authorization header [1]
- The Authentication credentials of the client application.
Response
Response Body
{ "list": [ { "serverName": "{serverName}", "details": "http://{server_name}/accounts/{account_number}/dedicatedServers/{dedicated_server_id}", } ], "links": [ { "href" : "http://{server_name}/accounts/{account_number}/dedicatedServers?page=2&pageSize=2", "rel" : "self" }, { "href" : "http://{server_name}/accounts/{account_number}/dedicatedServers?page=1&pageSize=2", "rel" : "first" }, { "href" : "http://{server_name}/accounts/{account_number}/dedicatedServers?page=1&pageSize=2", "rel" : "previous" }, { "href" : "http://{server_name}/accounts/{account_number}/dedicatedServers?page=1&pageSize=3", "rel" : "next" }, { "href" : "http://{server_name}/accounts/{account_number}/dedicatedServers?page=1&pageSize=3", "rel" : "last" } ] }
Parameters
- serverName - string
- The name of an individual dedicated server
- details - string
- hypermedia to the give dedicated server
- links - list
- Hypermedia for this resource. Link to self will preserve sorting and pagination set by the request. Links to the first, last, previous and next pages will also be included if applicable
Expected Response Codes
- 200 OK
- Success
- 401 Unauthorized
- The supplied credentials are invalid.
- 403 Forbidden
- The authorized user does not have permissions to access the resource. The only user(s) who has access to the dedicated servers list must be a sales agent, the account owner, or the account technical admin.
- 404 Not Found
- The account does not exist.
Examples
Get a list of dedicated servers
Request
GET accounts/test-account123/dedicatedServers
Response
{ "list": [ { "serverName": "Server Name 1", "details": "{{APIBaseURL}}/accounts/test-account123/dedicatedServers/server-id-1" }, { "serverName": "Server Name 2", "details": "{{APIBaseURL}}/accounts/test-account123/dedicatedServers/server-id-2" }, { "serverName": "Server Name 3", "details": "{{APIBaseURL}}/accounts/test-account123/dedicatedServers/server-id-3" } ], "links": [ { "href": "{{APIBaseURL}}/accounts/test-account123/dedicatedServers/", "rel": "self" } ] }
Get a list of dedicated servers sorted by server name in an descending order
Request
GET accounts/test-account123/dedicatedServers?sortField=serverName&sortOrder=desc
Response
{ "list": [ { "serverName": "Server Name 3", "details": "{{APIBaseURL}}/accounts/test-account123/dedicatedServers/server-id-3" }, { "serverName": "Server Name 2", "details": "{{APIBaseURL}}/accounts/test-account123/dedicatedServers/server-id-2" }, { "serverName": "Server Name 1", "details": "{{APIBaseURL}}/accounts/test-account123/dedicatedServers/server-id-1" } ], "links": [ { "href": "{{APIBaseURL}}/accounts/test-account123/dedicatedServers?sortField=serverName&sortOrder=desc", "rel": "self" } ] }
Get a list of dedicated servers with pagination
Request
GET accounts/test-account123/test.com/dedicatedServers?page=2&pageSize=2
Response
{ "list": [ { "serverName": "Server Name 1", "details": "{{APIBaseURL}}/accounts/test-account123/dedicatedServers/server-id-1" }, { "username": "Server Name 2", "details": "{{APIBaseURL}}/accounts/test-account123/dedicatedServers/server-id-2" } ], "links": [ { "href": "{{APIBaseURL}}/accounts/test-account123/dedicatedServers?page=2&pageSize=2", "rel": "self" }, { "href": "{{APIBaseURL}}/accounts/test-account123/dedicatedServers?page=1&pageSize=2", "rel": "first" }, { "href": "{{APIBaseURL}}/accounts/test-account123/dedicatedServers?page=1&pageSize=2", "rel": "previous" }, { "href": "{{APIBaseURL}}/accounts/test-account123/dedicatedServers?page=3&pageSize=2", "rel": "next" }, { "href": "{{APIBaseURL}}/accounts/test-account123/dedicatedServers?page=3&pageSize=2", "rel": "last" } ] }
See also