Get CVM network info
curl --request GET \
--url https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/networkimport requests
url = "https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/network"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/network', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/network",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/network"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/network")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/network")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"is_online": true,
"ingress": {
"gateway_enabled": true,
"port_policy": {
"ports": [
{
"port": 123,
"pp": false
}
],
"restrict_mode": false
}
},
"port_mappings": [
{
"id": "pm_0123abcd",
"host_port": 123,
"vm_port": 123,
"protocol": "<string>",
"host_address": "<string>",
"nic_index": 0,
"source_cidrs": [
"<string>"
],
"description": "<string>",
"public_host": "<string>",
"forwarding_backend": "vmm_hostfwd",
"restart_required": false,
"guest_ip": "<string>"
}
],
"endpoints": {
"kms_urls": [
"<string>"
],
"gateway_urls": [
"<string>"
],
"kms_urls_overridden": true,
"gateway_urls_overridden": true
},
"is_public": true,
"error": "<string>",
"internal_ip": "<string>",
"latest_handshake": "2023-11-07T05:31:56Z",
"public_urls": [
{
"app": "<string>",
"instance": "<string>"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}CVMs
Get CVM network info
Returns gateway status (internal IP, handshake time, public URLs) and the three network layers: gateway ingress from the compose (ingress), direct port mappings (port_mappings, as GET /ports) and the KMS/gateway URLs updates send (endpoints).
GET
/
api
/
v1
/
cvms
/
{cvm_id}
/
network
Get CVM network info
curl --request GET \
--url https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/networkimport requests
url = "https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/network"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/network', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/network",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/network"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/network")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/network")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"is_online": true,
"ingress": {
"gateway_enabled": true,
"port_policy": {
"ports": [
{
"port": 123,
"pp": false
}
],
"restrict_mode": false
}
},
"port_mappings": [
{
"id": "pm_0123abcd",
"host_port": 123,
"vm_port": 123,
"protocol": "<string>",
"host_address": "<string>",
"nic_index": 0,
"source_cidrs": [
"<string>"
],
"description": "<string>",
"public_host": "<string>",
"forwarding_backend": "vmm_hostfwd",
"restart_required": false,
"guest_ip": "<string>"
}
],
"endpoints": {
"kms_urls": [
"<string>"
],
"gateway_urls": [
"<string>"
],
"kms_urls_overridden": true,
"gateway_urls_overridden": true
},
"is_public": true,
"error": "<string>",
"internal_ip": "<string>",
"latest_handshake": "2023-11-07T05:31:56Z",
"public_urls": [
{
"app": "<string>",
"instance": "<string>"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Response
Network info (may have error if offline)
Gateway status plus the three network layers of a CVM.
Was this page helpful?

