Logo
OpenScaler
API DocumentationComputer Public Ports

Expose port for VM

POST
/v1/vms/{vm_id}/public_ports

Exposes internal port in VM to public traffic. For example if a user want to publish 80 port in their VM, they can do so by sending a POST request to /v2/vms/{vm_id}/public_ports with the following payload:

{  "port": 80,  "desc": "Server 123"}

Authorization

bearer_auth
AuthorizationBearer <token>

Authentication

Create an API token on Profile, or with osctl auth login. Send it in the Authorization header:

Authorization: Bearer os1_...

Do not use the Keycloak web-session JWT as an API token. Keep the secret secure and do not share it.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

body?unknown

Response Body

application/json

application/json

text/pain

application/json

application/json

application/json

curl -X POST "https://example.com/v1/vms/{vm_id}/public_ports" \  -H "Content-Type: application/json" \  -d '{}'
{  "public_port": 9003}
{  "errors": [    {      "message": "'vcpus' field must be an integer",      "field": "resource_id"    }  ]}
"Access denied"
{  "errors": [    {      "message": "VM with ID 23 not found"    }  ]}
{  "errors": [    {      "message": "User not initialized. Send POST /v1/init, then retry the request."    }  ]}
{  "errors": [    {      "message": "VM with ID 23 not found"    }  ]}