Create a snapshot
curl --request POST \
--url https://api.microsandbox.dev/v1/orgs/{slug}/snapshots \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"sandbox_id": "<string>",
"kind": "disk",
"dest_dir": "<string>",
"force": true,
"labels": {},
"record_integrity": true
}
'import requests
url = "https://api.microsandbox.dev/v1/orgs/{slug}/snapshots"
payload = {
"name": "<string>",
"sandbox_id": "<string>",
"kind": "disk",
"dest_dir": "<string>",
"force": True,
"labels": {},
"record_integrity": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
sandbox_id: '<string>',
kind: 'disk',
dest_dir: '<string>',
force: true,
labels: {},
record_integrity: true
})
};
fetch('https://api.microsandbox.dev/v1/orgs/{slug}/snapshots', 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://api.microsandbox.dev/v1/orgs/{slug}/snapshots",
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([
'name' => '<string>',
'sandbox_id' => '<string>',
'kind' => 'disk',
'dest_dir' => '<string>',
'force' => true,
'labels' => [
],
'record_integrity' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.microsandbox.dev/v1/orgs/{slug}/snapshots"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"sandbox_id\": \"<string>\",\n \"kind\": \"disk\",\n \"dest_dir\": \"<string>\",\n \"force\": true,\n \"labels\": {},\n \"record_integrity\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.microsandbox.dev/v1/orgs/{slug}/snapshots")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"sandbox_id\": \"<string>\",\n \"kind\": \"disk\",\n \"dest_dir\": \"<string>\",\n \"force\": true,\n \"labels\": {},\n \"record_integrity\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.microsandbox.dev/v1/orgs/{slug}/snapshots")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"sandbox_id\": \"<string>\",\n \"kind\": \"disk\",\n \"dest_dir\": \"<string>\",\n \"force\": true,\n \"labels\": {},\n \"record_integrity\": true\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"kind": "disk",
"status": "queued",
"updated_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"error": {
"code": "<string>",
"message": "<string>"
},
"result": {
"created_at": "2023-11-07T05:31:56Z",
"digest": "<string>",
"labels": {},
"location": {
"id": "<string>",
"type": "managed"
},
"manifest": {
"artifact": "<string>",
"created_at": "<string>",
"extensions": {},
"image": {
"manifest_digest": "<string>",
"ref": "<string>"
},
"labels": {},
"requires": [
"<string>"
],
"schema": 1,
"scope": "disk",
"state": {
"format": "raw",
"fstype": "<string>",
"upper": {
"file": "<string>",
"size_bytes": 1,
"integrity": {
"algorithm": "sha256",
"digest": "<string>"
}
},
"kind": "file"
},
"parent": "<string>",
"source_sandbox": "<string>"
},
"name": "<string>",
"size_bytes": 1,
"kind": "disk",
"sandbox_id": "<string>"
}
}Authorizations
Personal access token (msb_pat_…) or session JWT - the credential an agent acts with on a user's behalf.
Path Parameters
Organization slug
Body
Wire shape of a cloud snapshot create request body.
Snapshot name.
Immutable identifier of the sandbox to capture.
disk Directory on a mounted host volume to write the artifact into. None
stores the snapshot in managed snapshot storage.
Replace an existing snapshot with the same name.
User-defined labels stored on the snapshot.
Show child attributes
Show child attributes
Record payload integrity metadata during capture.
Response
Snapshot capture queued
Wire shape of the asynchronous snapshot operation returned by snapshot capture endpoints.
Creation timestamp.
Server-side operation identifier.
Kind of snapshot being captured.
disk Current operation status.
queued, in_progress, succeeded, failed Timestamp of the most recent status change.
Timestamp of the terminal status, when the operation has finished.
Error details for a failed operation.
Show child attributes
Show child attributes
The resulting snapshot, present once the operation succeeds.
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://api.microsandbox.dev/v1/orgs/{slug}/snapshots \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"sandbox_id": "<string>",
"kind": "disk",
"dest_dir": "<string>",
"force": true,
"labels": {},
"record_integrity": true
}
'import requests
url = "https://api.microsandbox.dev/v1/orgs/{slug}/snapshots"
payload = {
"name": "<string>",
"sandbox_id": "<string>",
"kind": "disk",
"dest_dir": "<string>",
"force": True,
"labels": {},
"record_integrity": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
sandbox_id: '<string>',
kind: 'disk',
dest_dir: '<string>',
force: true,
labels: {},
record_integrity: true
})
};
fetch('https://api.microsandbox.dev/v1/orgs/{slug}/snapshots', 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://api.microsandbox.dev/v1/orgs/{slug}/snapshots",
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([
'name' => '<string>',
'sandbox_id' => '<string>',
'kind' => 'disk',
'dest_dir' => '<string>',
'force' => true,
'labels' => [
],
'record_integrity' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.microsandbox.dev/v1/orgs/{slug}/snapshots"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"sandbox_id\": \"<string>\",\n \"kind\": \"disk\",\n \"dest_dir\": \"<string>\",\n \"force\": true,\n \"labels\": {},\n \"record_integrity\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.microsandbox.dev/v1/orgs/{slug}/snapshots")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"sandbox_id\": \"<string>\",\n \"kind\": \"disk\",\n \"dest_dir\": \"<string>\",\n \"force\": true,\n \"labels\": {},\n \"record_integrity\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.microsandbox.dev/v1/orgs/{slug}/snapshots")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"sandbox_id\": \"<string>\",\n \"kind\": \"disk\",\n \"dest_dir\": \"<string>\",\n \"force\": true,\n \"labels\": {},\n \"record_integrity\": true\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"kind": "disk",
"status": "queued",
"updated_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"error": {
"code": "<string>",
"message": "<string>"
},
"result": {
"created_at": "2023-11-07T05:31:56Z",
"digest": "<string>",
"labels": {},
"location": {
"id": "<string>",
"type": "managed"
},
"manifest": {
"artifact": "<string>",
"created_at": "<string>",
"extensions": {},
"image": {
"manifest_digest": "<string>",
"ref": "<string>"
},
"labels": {},
"requires": [
"<string>"
],
"schema": 1,
"scope": "disk",
"state": {
"format": "raw",
"fstype": "<string>",
"upper": {
"file": "<string>",
"size_bytes": 1,
"integrity": {
"algorithm": "sha256",
"digest": "<string>"
}
},
"kind": "file"
},
"parent": "<string>",
"source_sandbox": "<string>"
},
"name": "<string>",
"size_bytes": 1,
"kind": "disk",
"sandbox_id": "<string>"
}
}