Allocate Flexible IP

From Hostway API Documentation
(Difference between revisions)
Jump to: navigation, search
m (1 revision: Release 86)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
A Flexible IP address is a static IP address that can be bound to any single Server. When you associate a flexible IP with a Server the IP is bound to that Server's network interface. You will use your flexible IP to connect to your Server. You can allocate IPs and release IPs from your account as needed.
 
A Flexible IP address is a static IP address that can be bound to any single Server. When you associate a flexible IP with a Server the IP is bound to that Server's network interface. You will use your flexible IP to connect to your Server. You can allocate IPs and release IPs from your account as needed.
  
=='''POST''' /os-floating-ips==
+
='''POST''' /accounts/{accountId}/flexcloud/os-floating-ips=
 
Allocates a new flexible IP.
 
Allocates a new flexible IP.
  
=== Response ===
+
== Request ==
==== JSON ====
+
<nowiki>
 +
{
 +
    "zone": "AUS001"
 +
}</nowiki>
 +
 
 +
=== Parameters ===
 +
; accountId - ''string''
 +
: The selected account Id.
 +
 
 +
== Response ==
 +
=== JSON ===
 
  <nowiki>
 
  <nowiki>
 
{
 
{
Line 14: Line 24:
 
       "links" : [
 
       "links" : [
 
         {
 
         {
             "href" : "http://{api_server}/os-floating-ips/{ip_address}/",  
+
             "href" : "http://{api_server}/accounts/{accountId}/flexcloud/os-floating-ips/{ip_address}/",  
 
             "rel" : "self"
 
             "rel" : "self"
 
         }
 
         }
Line 20: Line 30:
 
       "pool" : "default"
 
       "pool" : "default"
 
   }
 
   }
}
+
}</nowiki>
</nowiki>
+
  
=====floating_ip=====
+
====floating_ip====
 
; instance_id - ''string''
 
; instance_id - ''string''
 
: Unique instance identifier floating IP is assigned to.
 
: Unique instance identifier floating IP is assigned to.
Line 39: Line 48:
 
: Name of the pool IP address belongs to.
 
: Name of the pool IP address belongs to.
  
=== Response Codes ===
+
== Response Codes ==
 
; Success
 
; Success
 
: ''HTTP/1.1 202 Accepted''
 
: ''HTTP/1.1 202 Accepted''
Line 45: Line 54:
 
; Failure
 
; Failure
 
: ''HTTP/1.1 401 Unauthorized'' : This server could not verify that you are authorized to access the document you requested.  Either you supplied incorrect credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
 
: ''HTTP/1.1 401 Unauthorized'' : This server could not verify that you are authorized to access the document you requested.  Either you supplied incorrect credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
 +
: ''HTTP/1.1 404 Resource not found'' : The resource was accessed with wrong account number
  
=== Examples ===
+
== Examples ==
 
'''Successfully allocate a flexible IP'''
 
'''Successfully allocate a flexible IP'''
:'''POST''' http(s)://{api_server}/os-floating-ips
+
:'''POST''' http(s)://{api_server}/accounts/{accountId}/flexcloud/os-floating-ips
  
 
''Request Headers:''
 
''Request Headers:''
Line 67: Line 77:
 
       "links" : [
 
       "links" : [
 
         {
 
         {
             "href" : "http://{api_server}/os-floating-ips/{ip_address}/",  
+
             "href" : "http://{api_server}/account/{accountId}/flexcloud/os-floating-ips/{ip_address}/",  
 
             "rel" : "self"
 
             "rel" : "self"
 
         }
 
         }
Line 73: Line 83:
 
       "pool" : "default"
 
       "pool" : "default"
 
   }  
 
   }  
}
+
}</nowiki>
</nowiki>
+
  
 
'''Unauthorized access'''
 
'''Unauthorized access'''
:'''POST''' <nowiki>http://{api_server}/os-floating-ips</nowiki>
+
:'''POST''' <nowiki>http://{api_server}/accounts/{accountId}/flexcloud/os-floating-ips</nowiki>
  
 
''Request Headers:''
 
''Request Headers:''
Line 94: Line 103:
 
     does not understand how to supply the credentials required.
 
     does not understand how to supply the credentials required.
  
 +
'''Failure while trying to pass invalid account number'''
 +
:'''POST''' <nowiki>http://{api_server}/accounts/fake/flexcloud/os-floating-ips</nowiki>
  
[[Category:Hostway API]]
+
''Response Code:''
[[Category:FlexCloud Server API]]
+
<pre>HTTP/1.1 404 Not Found</pre>
  
<!-- THIS CODE ENABLES DISQUS COMMENTS ON THE PAGE - DELETE TO DISABLE COMMENTING-->
+
''Response Body:''
 +
<nowiki>
 +
  {
 +
    "itemNotFound" : {
 +
      "message": "Resource not found",
 +
      "code": 404,
 +
      "details": "",
 +
      "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
 +
    }
 +
}</nowiki>
  
{{#widget:DISQUS
+
== Alternative URI /os-floating-ips ==
|id=hostway
+
An alternative way to execute this call is to omit the ''accountId'' portion of the URI. In this case the system assumes the request is executed for the account identified in the [[Authentication|authorization header]].
|uniqid={{PAGENAME}}
+
|url={{fullurl:{{PAGENAME}}}}
+
}}
+
  
<!--  ########################################################################### -->
+
<code>POST /os-floating-ips</code>
 +
 
 +
[[Category:Hostway API]]
 +
[[Category:FlexCloud Server API]]

Latest revision as of 11:00, 11 October 2013

A Flexible IP address is a static IP address that can be bound to any single Server. When you associate a flexible IP with a Server the IP is bound to that Server's network interface. You will use your flexible IP to connect to your Server. You can allocate IPs and release IPs from your account as needed.

Contents

[edit] POST /accounts/{accountId}/flexcloud/os-floating-ips

Allocates a new flexible IP.

[edit] Request

{
    "zone": "AUS001"
}

[edit] Parameters

accountId - string
The selected account Id.

[edit] Response

[edit] JSON

{
   "floating_ip" : {
      "instance_id" : "{instance_id}", 
      "ip" : "{ip_address}", 
      "fixed_ip" : null, 
      "links" : [
         {
            "href" : "http://{api_server}/accounts/{accountId}/flexcloud/os-floating-ips/{ip_address}/", 
            "rel" : "self"
         }
      ], 
      "pool" : "default"
   }
}

[edit] floating_ip

instance_id - string
Unique instance identifier floating IP is assigned to.
ip - string
IP address allocated.
fixed_ip - string
Fixed IP address.
links - list
Hypermedia for this resource.
pool - string
Name of the pool IP address belongs to.

[edit] Response Codes

Success
HTTP/1.1 202 Accepted
Failure
HTTP/1.1 401 Unauthorized : This server could not verify that you are authorized to access the document you requested. Either you supplied incorrect credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
HTTP/1.1 404 Resource not found : The resource was accessed with wrong account number

[edit] Examples

Successfully allocate a flexible IP

POST http(s)://{api_server}/accounts/{accountId}/flexcloud/os-floating-ips

Request Headers:

   Content-Type:application/json
   Charset=UTF-8
   Authorization:Base64-encoded username & password string

Response Code:

HTTP/1.1 202 Accepted

Response Body:

{
   "floating_ip" : {
      "instance_id" : null, 
      "ip" : "{ip_address}", 
      "fixed_ip" : null, 
      "links" : [
         {
            "href" : "http://{api_server}/account/{accountId}/flexcloud/os-floating-ips/{ip_address}/", 
            "rel" : "self"
         }
      ], 
      "pool" : "default"
   } 
}

Unauthorized access

POST http://{api_server}/accounts/{accountId}/flexcloud/os-floating-ips

Request Headers:

   Content-Type:application/json
   Charset=UTF-8
   Authorization:Base64-encoded fake_authentication_string

Response Code:

HTTP/1.1 401 Unauthorized

Response Body:

    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.

Failure while trying to pass invalid account number

POST http://{api_server}/accounts/fake/flexcloud/os-floating-ips

Response Code:

HTTP/1.1 404 Not Found

Response Body:

 {
    "itemNotFound" : {
       "message": "Resource not found", 
       "code": 404, 
       "details": "",
       "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
    }
 }

[edit] Alternative URI /os-floating-ips

An alternative way to execute this call is to omit the accountId portion of the URI. In this case the system assumes the request is executed for the account identified in the authorization header.

POST /os-floating-ips

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox