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

From Hostway API Documentation
Jump to: navigation, search

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

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

Contents


Request

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

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

Request Headers

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

Request Body

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

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

Response

Response Headers

Location
Link to the created resource

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.

Examples

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
 

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

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