Create Load Balancer
From Hostway API Documentation
(Difference between revisions)
(→Request Body) |
Mike.robski (Talk | contribs) m (1 revision: Release 109) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
='''POST''' /accounts/''{accountId}''/loadbalancers= | ='''POST''' /accounts/''{accountId}''/loadbalancers= | ||
− | This operation | + | This operation creates a new load balancer. |
== Request == | == Request == | ||
− | === | + | <code>POST /accounts/''{accountId}''/loadbalancers</code> |
+ | |||
+ | === Request Parameters === | ||
; accountId - ''string'' | ; accountId - ''string'' | ||
− | : The selected account | + | : The selected account id. |
=== Request Body === | === Request Body === | ||
<nowiki> | <nowiki> | ||
− | + | { | |
"region": "{regionTextKey}", | "region": "{regionTextKey}", | ||
− | "displayName": "{lbName}" | + | "displayName": "{lbName}" |
− | + | }</nowiki> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
==== Parameters ==== | ==== Parameters ==== | ||
Line 49: | Line 23: | ||
: Display name for this load balancer. | : Display name for this load balancer. | ||
− | + | == Response == | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=== Response Codes === | === Response Codes === | ||
Line 88: | Line 30: | ||
; 400 Bad Request | ; 400 Bad Request | ||
+ | : The request has wrong data | ||
; 401 Unauthorized | ; 401 Unauthorized | ||
Line 100: | Line 43: | ||
== Examples == | == Examples == | ||
+ | |||
+ | === create a LB === | ||
'''Request''' | '''Request''' | ||
Line 105: | Line 50: | ||
POST /accounts/{accountId}/loadbalancers | POST /accounts/{accountId}/loadbalancers | ||
Content-Type: application/json; Charset=UTF-8 | Content-Type: application/json; Charset=UTF-8 | ||
− | Authorization: Base64-encoded username & password string | + | Authorization: Basic {Base64-encoded username & password string} |
{ | { | ||
"region": "AUSTIN", | "region": "AUSTIN", | ||
"displayName" : "Test Load Balancer", | "displayName" : "Test Load Balancer", | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
</pre> | </pre> | ||
Line 130: | Line 62: | ||
201 Created | 201 Created | ||
Content-Type: application/json; charset=UTF-8 | Content-Type: application/json; charset=UTF-8 | ||
− | Location : </ | + | Location : http://{api-server}/account/{accountId}/loadbalancers/{newLbId} |
+ | </pre> | ||
+ | |||
+ | === Failure while trying to make unauthorized access === | ||
+ | |||
+ | '''Request''' | ||
+ | <pre> | ||
+ | POST /accounts/{accountId}/loadbalancers | ||
+ | Content-Type:application/json | ||
+ | Charset=UTF-8 | ||
+ | Authorization: Basic {Base64-encoded username & password string} | ||
+ | </pre> | ||
+ | |||
+ | '''Response''' | ||
+ | <pre> | ||
+ | HTTP/1.1 401 Unauthorized | ||
+ | </pre> | ||
+ | |||
+ | === Failure while trying to pass invalid account number === | ||
+ | '''Request''' | ||
+ | <pre> | ||
+ | POST /accounts/fake/loadbalancers | ||
+ | Content-Type:application/json | ||
+ | Charset=UTF-8 | ||
+ | Authorization: Basic {wrong credential} | ||
+ | </pre> | ||
+ | |||
+ | '''Response''' | ||
+ | <pre> | ||
+ | HTTP/1.1 404 Not Found | ||
+ | |||
+ | { | ||
+ | "itemNotFound" : { | ||
+ | "message": "Resource not found", | ||
+ | "code": 404, | ||
+ | "details": "", | ||
+ | "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf" | ||
+ | } | ||
+ | } | ||
</pre> | </pre> | ||
[[Category:Hostway API]] | [[Category:Hostway API]] | ||
[[Category:Load Balancer API]] | [[Category:Load Balancer API]] |
Latest revision as of 12:13, 24 July 2015
Contents |
POST /accounts/{accountId}/loadbalancers
This operation creates a new load balancer.
Request
POST /accounts/{accountId}/loadbalancers
Request Parameters
- accountId - string
- The selected account id.
Request Body
{ "region": "{regionTextKey}", "displayName": "{lbName}" }
Parameters
- region - string
- region TextKey where LB will be created
- displayName - string
- Display name for this load balancer.
Response
Response Codes
- 201 Created
- 400 Bad Request
- The request has wrong data
- 401 Unauthorized
- This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
- 409 Conflict
- The resource already exists. (there is already a load balancer with that name or a load balancer already bound to the virtualIp/port combination specified)
Response Headers
- Location
- Returned with successful 201 response. Contains the new LB URI. The client must use this URI for all subsequent operations with the LB.
Examples
create a LB
Request
POST /accounts/{accountId}/loadbalancers Content-Type: application/json; Charset=UTF-8 Authorization: Basic {Base64-encoded username & password string} { "region": "AUSTIN", "displayName" : "Test Load Balancer", }
Response
201 Created Content-Type: application/json; charset=UTF-8 Location : http://{api-server}/account/{accountId}/loadbalancers/{newLbId}
Failure while trying to make unauthorized access
Request
POST /accounts/{accountId}/loadbalancers Content-Type:application/json Charset=UTF-8 Authorization: Basic {Base64-encoded username & password string}
Response
HTTP/1.1 401 Unauthorized
Failure while trying to pass invalid account number
Request
POST /accounts/fake/loadbalancers Content-Type:application/json Charset=UTF-8 Authorization: Basic {wrong credential}
Response
HTTP/1.1 404 Not Found { "itemNotFound" : { "message": "Resource not found", "code": 404, "details": "", "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf" } }