九章智算云

获取端口列表

获取CCI容器计算实例已开通的端口列表。

GEThttps://api.alayanew.com/v1/cci/instance/{id}/open-port/list

鉴权(Authorizations)

AuthorizationString必填

用户可通过已获取的 Open API Key 做验证。例如:Bearer [YOUR_API_KEY]

Path Parameters

idString必填

实例ID,实例的唯一标识符,例如:08ba7a0e-af00-4072-a5e5-1298ed6c1aa0

Response

statusInteger

业务状态码,200表示成功。

messageString

接口响应信息,成功或失败原因描述。

dataObject

开放端口响应对象。

显示 properties
portsArray<Object>

system端口,没有协议。

显示 properties
protocolString

协议。例如: "http/https"

portInteger

端口。例如: 80

externalHostString

外部访问ip。例如: "192.168.1.1"

externalPortInteger

外部访问端口。例如: 31443

customPortsArray<Object>

自定义端口。

显示 properties
protocolString

协议。例如: "http/https"

portInteger

端口。例如: 80

externalHostString

外部访问ip。例如: "192.168.1.1"

externalPortInteger

外部访问端口。例如: 31443

curl -X 'GET' \
  'https://api.alayanew.com/v1/cci/instance/08ba7a0e-af00-4072-a5e5-1298ed6c1aa0/open-port/list' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer [YOUR_API_KEY]'
import requests

url = "https://api.alayanew.com/v1/cci/instance/08ba7a0e-af00-4072-a5e5-1298ed6c1aa0/open-port/list"

headers = {
    "accept": "application/json",
    "Authorization": "Bearer [YOUR_API_KEY]"
}

response = requests.get(url, headers=headers)

print(response.text)
fetch('https://api.alayanew.com/v1/cci/instance/08ba7a0e-af00-4072-a5e5-1298ed6c1aa0/open-port/list', {
  method: 'GET',
  headers: {
    'accept': 'application/json',
    'Authorization': 'Bearer [YOUR_API_KEY]'
  }
})
  .then(response => response.text())
  .then(data => console.log(data))
  .catch(error => console.error(error));
{
  "status": 200,
  "message": "OK",
  "data": {
    "ports": [
      {
        "protocol": "http/https",
        "port": 80,
        "externalHost": "192.168.1.1",
        "externalPort": 31443
      }
    ],
    "customPorts": [
      {
        "protocol": "http/https",
        "port": 80,
        "externalHost": "192.168.1.1",
        "externalPort": 31443
      }
    ]
  }
}
{
  "status": 403,
  "message": "Forbidden",
  "data": {}
}
{
  "status": 500,
  "message": "Internal Server Error",
  "data": {}
}

最后更新于