九章智算云
查询已开放端口

查询实例已开放的端口列表,含系统内置端口与调用方自行开放的自定义端口。同步返回。

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

鉴权(Authorizations)

AuthorizationString必填

用户获取Authorization请求头后,通过该请求头完成身份认证。例如:Authorization: [your-auth-header]。

Path Parameters

idString必填

实例 ID(来自查询实例列表的 id)。例如:2006a5d0-0a55-4e8f-9d3c-b7a1f20c5d88。

Response

statusInteger

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

messageString

接口响应信息。例如:"OK"。

dataObject

端口信息。

显示 properties
portsArray

系统内置端口列表,元素字段见下。

显示 properties
protocolString

端口协议:http / https。例如:"http"。

portInteger

端口号。例如:8888。

externalHostString

外部访问地址。例如:"cci-ssh.example.com"。

externalPortInteger

外部访问端口。例如:31511。

customPortsArray

自定义端口列表,元素字段同 ports。

显示 properties
protocolString

端口协议:http / https。例如:"http"。

portInteger

端口号。例如:6006。

externalHostString

外部访问地址。例如:"cci-demo.example.com"。

externalPortInteger

外部访问端口。例如:32122。

curl -X 'GET' \
  'https://api.alayanew.com/api/osm/v1/cci/instance/2006a5d0-0a55-4e8f-9d3c-b7a1f20c5d88/open-port/list' \
  -H 'accept: application/json' \
  -H 'Authorization: [your-auth-header]'
import requests

instance_id = "2006a5d0-0a55-4e8f-9d3c-b7a1f20c5d88"
url = f"https://api.alayanew.com/api/osm/v1/cci/instance/{instance_id}/open-port/list"
headers = {
    "accept": "application/json",
    "Authorization": "[your-auth-header]"
}

response = requests.get(url, headers=headers)
print(response.json())
const instanceId = '2006a5d0-0a55-4e8f-9d3c-b7a1f20c5d88';

fetch(`https://api.alayanew.com/api/osm/v1/cci/instance/${instanceId}/open-port/list`, {
  method: 'GET',
  headers: {
    'accept': 'application/json',
    'Authorization': '[your-auth-header]'
  }
})
  .then(res => res.json())
  .then(console.log)
  .catch(console.error);
{
  "status": 200,
  "message": "OK",
  "data": {
    "ports": [
      {
        "protocol": "http",
        "port": 8888,
        "externalHost": "cci-ssh.example.com",
        "externalPort": 31511
      }
    ],
    "customPorts": [
      {
        "protocol": "http",
        "port": 6006,
        "externalHost": "cci-demo.example.com",
        "externalPort": 32122
      }
    ]
  }
}

最后更新于