curl --request POST \
--url https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/draft/apply \
--header 'Content-Type: application/json' \
--data '
{
"base_compose_hash": "<string>"
}
'import requests
url = "https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/draft/apply"
payload = { "base_compose_hash": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({base_compose_hash: '<string>'})
};
fetch('https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/draft/apply', 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}/draft/apply",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'base_compose_hash' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/draft/apply"
payload := strings.NewReader("{\n \"base_compose_hash\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/draft/apply")
.header("Content-Type", "application/json")
.body("{\n \"base_compose_hash\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/draft/apply")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"base_compose_hash\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"error_code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"value": null,
"message": "<string>"
}
],
"suggestions": [
"<string>"
],
"links": [
{
"url": "<string>",
"label": "<string>"
}
],
"request_id": "<string>"
}{
"error_code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"value": null,
"message": "<string>"
}
],
"suggestions": [
"<string>"
],
"links": [
{
"url": "<string>",
"label": "<string>"
}
],
"request_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Apply staged CVM changes
Applies every staged change as one PATCH /cvms/: one VMM update and at most one restart; a stopped CVM stays stopped. Rejected with ERR-03-053 when the CVM’s compose changed since the first change was staged. Accepts the same X-Compose-Hash, X-Transaction-Hash and X-Prepare-Only headers and returns the same responses as PATCH /cvms/; the staged changes are kept until an apply dispatches them. A phase 2 apply is rejected with ERR-03-054 when changes were staged after its phase 1; apply again without the headers to prepare them. An update committed through a commit token (POST /cvms//commit-update) does not clear them: the next apply is then rejected with ERR-03-053, and the staged changes must be discarded.
curl --request POST \
--url https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/draft/apply \
--header 'Content-Type: application/json' \
--data '
{
"base_compose_hash": "<string>"
}
'import requests
url = "https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/draft/apply"
payload = { "base_compose_hash": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({base_compose_hash: '<string>'})
};
fetch('https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/draft/apply', 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}/draft/apply",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'base_compose_hash' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/draft/apply"
payload := strings.NewReader("{\n \"base_compose_hash\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/draft/apply")
.header("Content-Type", "application/json")
.body("{\n \"base_compose_hash\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/draft/apply")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"base_compose_hash\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"error_code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"value": null,
"message": "<string>"
}
],
"suggestions": [
"<string>"
],
"links": [
{
"url": "<string>",
"label": "<string>"
}
],
"request_id": "<string>"
}{
"error_code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"value": null,
"message": "<string>"
}
],
"suggestions": [
"<string>"
],
"links": [
{
"url": "<string>",
"label": "<string>"
}
],
"request_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Path Parameters
Body
The CVM compose hash the caller reviewed the changes against. Defaults to the draft's base; after ERR-03-053, send its current_compose_hash to apply anyway.
Response
Successful Response
Was this page helpful?

