Set the live deployment
curl --request POST \
--url https://api.canary.effectiveai.app/api/v2/apps/apps/{appId}/live \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"deploymentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expectedLiveDeploymentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"allowMigrationsAhead": false
}
'import requests
url = "https://api.canary.effectiveai.app/api/v2/apps/apps/{appId}/live"
payload = {
"deploymentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expectedLiveDeploymentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"allowMigrationsAhead": False
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
deploymentId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
expectedLiveDeploymentId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
allowMigrationsAhead: false
})
};
fetch('https://api.canary.effectiveai.app/api/v2/apps/apps/{appId}/live', 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.canary.effectiveai.app/api/v2/apps/apps/{appId}/live",
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([
'deploymentId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'expectedLiveDeploymentId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'allowMigrationsAhead' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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.canary.effectiveai.app/api/v2/apps/apps/{appId}/live"
payload := strings.NewReader("{\n \"deploymentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"expectedLiveDeploymentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"allowMigrationsAhead\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.canary.effectiveai.app/api/v2/apps/apps/{appId}/live")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"deploymentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"expectedLiveDeploymentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"allowMigrationsAhead\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.canary.effectiveai.app/api/v2/apps/apps/{appId}/live")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"deploymentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"expectedLiveDeploymentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"allowMigrationsAhead\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"appId": "<string>",
"sourceSha": "<string>",
"shape": "full",
"bundleSha256": "<string>",
"runtimeUrl": "<string>",
"mcpUrl": "<string>",
"createdByEmail": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"completedAt": "2023-11-07T05:31:56Z",
"idempotencyExpiresAt": "2023-11-07T05:31:56Z",
"status": "queued",
"stage": "<string>",
"checks": {
"passed": true,
"checkedAt": "2023-11-07T05:31:56Z",
"checks": [
{
"name": "<string>",
"passed": true,
"detail": "<string>"
}
]
},
"effects": {
"runtimeChanged": true,
"migrationsApplied": [
"<string>"
],
"migrationsStatus": "not_started",
"previousRuntimeRestored": true
},
"interface": {
"capabilities": [
"<string>"
],
"tools": [
{}
],
"openapiUrl": "<string>"
},
"error": {
"code": "<string>",
"error": "<string>",
"retryable": true,
"recovery": "<string>"
},
"live": true,
"target": {
"environment": "preview",
"branch": "<string>"
},
"previewUrl": "<string>",
"buildId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"appId": "<string>",
"sourceSha": "<string>",
"shape": "full",
"bundleSha256": "<string>",
"runtimeUrl": "<string>",
"mcpUrl": "<string>",
"createdByEmail": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"completedAt": "2023-11-07T05:31:56Z",
"idempotencyExpiresAt": "2023-11-07T05:31:56Z",
"status": "queued",
"stage": "<string>",
"checks": {
"passed": true,
"checkedAt": "2023-11-07T05:31:56Z",
"checks": [
{
"name": "<string>",
"passed": true,
"detail": "<string>"
}
]
},
"effects": {
"runtimeChanged": true,
"migrationsApplied": [
"<string>"
],
"migrationsStatus": "not_started",
"previousRuntimeRestored": true
},
"interface": {
"capabilities": [
"<string>"
],
"tools": [
{}
],
"openapiUrl": "<string>"
},
"error": {
"code": "<string>",
"error": "<string>",
"retryable": true,
"recovery": "<string>"
},
"live": true,
"target": {
"environment": "preview",
"branch": "<string>"
},
"previewUrl": "<string>",
"buildId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}Apps
Set the live deployment
Roll back or forward by serving an earlier successful deployment again. Its stored bundle goes through the same candidate deploy, probes and activation as createAppDeployment, as a new deployment to poll at Location. Only code changes: migrations are never reversed. When the database has migrations the chosen deployment lacks, this is refused with 409 migrations_ahead unless allowMigrationsAhead is true. After a lost response, repeat with the same Idempotency-Key.
Alpha: this operation may change or be removed without notice.
POST
/
apps
/
apps
/
{appId}
/
live
Set the live deployment
curl --request POST \
--url https://api.canary.effectiveai.app/api/v2/apps/apps/{appId}/live \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"deploymentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expectedLiveDeploymentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"allowMigrationsAhead": false
}
'import requests
url = "https://api.canary.effectiveai.app/api/v2/apps/apps/{appId}/live"
payload = {
"deploymentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expectedLiveDeploymentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"allowMigrationsAhead": False
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
deploymentId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
expectedLiveDeploymentId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
allowMigrationsAhead: false
})
};
fetch('https://api.canary.effectiveai.app/api/v2/apps/apps/{appId}/live', 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.canary.effectiveai.app/api/v2/apps/apps/{appId}/live",
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([
'deploymentId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'expectedLiveDeploymentId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'allowMigrationsAhead' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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.canary.effectiveai.app/api/v2/apps/apps/{appId}/live"
payload := strings.NewReader("{\n \"deploymentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"expectedLiveDeploymentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"allowMigrationsAhead\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.canary.effectiveai.app/api/v2/apps/apps/{appId}/live")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"deploymentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"expectedLiveDeploymentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"allowMigrationsAhead\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.canary.effectiveai.app/api/v2/apps/apps/{appId}/live")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"deploymentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"expectedLiveDeploymentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"allowMigrationsAhead\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"appId": "<string>",
"sourceSha": "<string>",
"shape": "full",
"bundleSha256": "<string>",
"runtimeUrl": "<string>",
"mcpUrl": "<string>",
"createdByEmail": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"completedAt": "2023-11-07T05:31:56Z",
"idempotencyExpiresAt": "2023-11-07T05:31:56Z",
"status": "queued",
"stage": "<string>",
"checks": {
"passed": true,
"checkedAt": "2023-11-07T05:31:56Z",
"checks": [
{
"name": "<string>",
"passed": true,
"detail": "<string>"
}
]
},
"effects": {
"runtimeChanged": true,
"migrationsApplied": [
"<string>"
],
"migrationsStatus": "not_started",
"previousRuntimeRestored": true
},
"interface": {
"capabilities": [
"<string>"
],
"tools": [
{}
],
"openapiUrl": "<string>"
},
"error": {
"code": "<string>",
"error": "<string>",
"retryable": true,
"recovery": "<string>"
},
"live": true,
"target": {
"environment": "preview",
"branch": "<string>"
},
"previewUrl": "<string>",
"buildId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"appId": "<string>",
"sourceSha": "<string>",
"shape": "full",
"bundleSha256": "<string>",
"runtimeUrl": "<string>",
"mcpUrl": "<string>",
"createdByEmail": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"completedAt": "2023-11-07T05:31:56Z",
"idempotencyExpiresAt": "2023-11-07T05:31:56Z",
"status": "queued",
"stage": "<string>",
"checks": {
"passed": true,
"checkedAt": "2023-11-07T05:31:56Z",
"checks": [
{
"name": "<string>",
"passed": true,
"detail": "<string>"
}
]
},
"effects": {
"runtimeChanged": true,
"migrationsApplied": [
"<string>"
],
"migrationsStatus": "not_started",
"previousRuntimeRestored": true
},
"interface": {
"capabilities": [
"<string>"
],
"tools": [
{}
],
"openapiUrl": "<string>"
},
"error": {
"code": "<string>",
"error": "<string>",
"retryable": true,
"recovery": "<string>"
},
"live": true,
"target": {
"environment": "preview",
"branch": "<string>"
},
"previewUrl": "<string>",
"buildId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": [
{
"location": "path",
"path": [
"<string>"
],
"code": "required",
"message": "<string>"
}
],
"requestId": "<string>",
"dataset": "naic",
"businessCode": "<string>",
"violations": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"value": "<unknown>",
"constraint": "<string>",
"cite": "<string>"
}
],
"violationsTruncated": true,
"executionId": "<string>",
"accessUrl": "<string>"
}Authorizations
Headers
Path Parameters
Body
application/json
Response
The same Idempotency-Key replayed a finished attempt.