Accounts-accountId-dedicatedServers-serverId-ipAddresses-ipaddress-natRules:POST

From Hostway API Documentation
(Difference between revisions)
Jump to: navigation, search
(Parameters)
 
m (1 revision: Release 111)
 

Latest revision as of 12:15, 18 September 2015

[edit] POST /accounts/{accountId}/dedicatedServers/{serverId}/ipAddresses/{ipAddress}/natRules

Create NAT rule, which is assigned to a specific IP address of a dedicated server

Contents


[edit] Request

POST /accounts/{accountId}/dedicatedServers/{serverId}/ipAddresses/{ipAddress}/natRules

[edit] Request Parameters

accountId - string
The user account owning the dedicated server
serverId - string
The specified dedicated server Id
ipAddress - string
The specified IP address of the dedicated server

[edit] Request Headers

Authorization - HTTP Authorization header [1]
The Authentication credentials of the client application.
Content-Type
application/json

[edit] Request Body

{
    "priority": {priority},
    "protocol": "{protocol}",
    "externalPort": {externalPort},
    "port": {port}
}
 

[edit] Parameters

priority - integer
rule priority, starting from 0 lowest priority
protocol - string
TCP, UDP, AH, ESP, GRE, AH+ESP or ALL
AH, ESP, GRE, AH+ESP, ALL protocols don't support port/externalPort - both should be 0
port - integer
internal port
externalPort - integer
external port

Note: When both port and externalPort are set to zero, this means - map all external ports to the same internal ports

[edit] Response

[edit] Response Headers

Location
Link to the created resource

[edit] Status Code

201 Created
Success.
400 Bad Request
Invalid request body.
401 Unauthorized
The supplied credentials are invalid or do not provide permissions for this operation.
403 Forbidden
The authorized user does not have permissions to access the resource.
404 Not Found
The IP address, dedicated server or account does not exist.
409 Conflict
Resource already exist.
415 Unsupported Media Type
The Content-Type header was not specified or the specified type is not supported. Use application/json.

[edit] Examples

[edit] Assign NAT rule to a specific dedicated server IP

Request

POST /accounts/test-acount/dedicatedServers/test-server-213/ipAddresses/1.1.1.1/natRules

{
    "priority": 0,
    "protocol": "TCP",
    "externalPort": 1234,
    "port": 4321,
}
 

Response

Location: https://api.hostway.com/accounts/test-acount/dedicatedServers/test-server-213/ipAddresses/1.1.1.1/natRules/test-rule-1

201 Created
 

[edit] Reassign existing NAT rule for a specific dedicated server IP

Request

POST /accounts/test-acount/dedicatedServers/test-server-213/ipAddresses/1.1.1.1/natRules

{
    "priority": 0,
    "protocol": "TCP",
    "externalPort": 1234,
    "port": 4321,
}
 

Response

409 Conflict

{"conflict": {"message": "Cannot create rule: The same rule test-rule-1 already exists", "code": 409}}
 

[edit] Request with invalid parameters

Request

POST /accounts/test-acount/dedicatedServers/test-server-213/ipAddresses/1.1.1.1/natRules

{
    "priority": -1,
    "protocol": "invalidProtocol",
    "externalPort": -100,
    "port": -100,
}
 

Response

400 Bad Request
 


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox