curl --request PUT \
--url https://app.miget.com/api/v1/apps/{uuid}/preview_environments/config \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"enabled": true,
"resource_id": "<string>",
"project_id": "<string>",
"trigger_label": "<string>",
"branch_pattern": "<string>",
"pr_name_pattern": "<string>",
"auto_deploy_on_push": true,
"cleanup_on_pr_merge": true,
"cleanup_on_pr_close": true,
"cleanup_on_branch_delete": true,
"cleanup_on_inactivity": true,
"inactivity_days": 123,
"retention_days": 123,
"comment_on_github": true,
"clone_settings": {},
"size": "<string>"
}
'import requests
url = "https://app.miget.com/api/v1/apps/{uuid}/preview_environments/config"
payload = {
"enabled": True,
"resource_id": "<string>",
"project_id": "<string>",
"trigger_label": "<string>",
"branch_pattern": "<string>",
"pr_name_pattern": "<string>",
"auto_deploy_on_push": True,
"cleanup_on_pr_merge": True,
"cleanup_on_pr_close": True,
"cleanup_on_branch_delete": True,
"cleanup_on_inactivity": True,
"inactivity_days": 123,
"retention_days": 123,
"comment_on_github": True,
"clone_settings": {},
"size": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
enabled: true,
resource_id: '<string>',
project_id: '<string>',
trigger_label: '<string>',
branch_pattern: '<string>',
pr_name_pattern: '<string>',
auto_deploy_on_push: true,
cleanup_on_pr_merge: true,
cleanup_on_pr_close: true,
cleanup_on_branch_delete: true,
cleanup_on_inactivity: true,
inactivity_days: 123,
retention_days: 123,
comment_on_github: true,
clone_settings: {},
size: '<string>'
})
};
fetch('https://app.miget.com/api/v1/apps/{uuid}/preview_environments/config', 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://app.miget.com/api/v1/apps/{uuid}/preview_environments/config",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'enabled' => true,
'resource_id' => '<string>',
'project_id' => '<string>',
'trigger_label' => '<string>',
'branch_pattern' => '<string>',
'pr_name_pattern' => '<string>',
'auto_deploy_on_push' => true,
'cleanup_on_pr_merge' => true,
'cleanup_on_pr_close' => true,
'cleanup_on_branch_delete' => true,
'cleanup_on_inactivity' => true,
'inactivity_days' => 123,
'retention_days' => 123,
'comment_on_github' => true,
'clone_settings' => [
],
'size' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://app.miget.com/api/v1/apps/{uuid}/preview_environments/config"
payload := strings.NewReader("{\n \"enabled\": true,\n \"resource_id\": \"<string>\",\n \"project_id\": \"<string>\",\n \"trigger_label\": \"<string>\",\n \"branch_pattern\": \"<string>\",\n \"pr_name_pattern\": \"<string>\",\n \"auto_deploy_on_push\": true,\n \"cleanup_on_pr_merge\": true,\n \"cleanup_on_pr_close\": true,\n \"cleanup_on_branch_delete\": true,\n \"cleanup_on_inactivity\": true,\n \"inactivity_days\": 123,\n \"retention_days\": 123,\n \"comment_on_github\": true,\n \"clone_settings\": {},\n \"size\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.put("https://app.miget.com/api/v1/apps/{uuid}/preview_environments/config")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"enabled\": true,\n \"resource_id\": \"<string>\",\n \"project_id\": \"<string>\",\n \"trigger_label\": \"<string>\",\n \"branch_pattern\": \"<string>\",\n \"pr_name_pattern\": \"<string>\",\n \"auto_deploy_on_push\": true,\n \"cleanup_on_pr_merge\": true,\n \"cleanup_on_pr_close\": true,\n \"cleanup_on_branch_delete\": true,\n \"cleanup_on_inactivity\": true,\n \"inactivity_days\": 123,\n \"retention_days\": 123,\n \"comment_on_github\": true,\n \"clone_settings\": {},\n \"size\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.miget.com/api/v1/apps/{uuid}/preview_environments/config")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"enabled\": true,\n \"resource_id\": \"<string>\",\n \"project_id\": \"<string>\",\n \"trigger_label\": \"<string>\",\n \"branch_pattern\": \"<string>\",\n \"pr_name_pattern\": \"<string>\",\n \"auto_deploy_on_push\": true,\n \"cleanup_on_pr_merge\": true,\n \"cleanup_on_pr_close\": true,\n \"cleanup_on_branch_delete\": true,\n \"cleanup_on_inactivity\": true,\n \"inactivity_days\": 123,\n \"retention_days\": 123,\n \"comment_on_github\": true,\n \"clone_settings\": {},\n \"size\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"enabled": true,
"resource_mode": "<string>",
"resource_id": "<string>",
"project_id": "<string>",
"trigger_mode": "<string>",
"trigger_filter": "<string>",
"trigger_label": "<string>",
"branch_pattern": "<string>",
"pr_name_pattern": "<string>",
"auto_deploy_on_push": true,
"cleanup_on_pr_merge": true,
"cleanup_on_pr_close": true,
"cleanup_on_branch_delete": true,
"cleanup_on_inactivity": true,
"inactivity_days": 123,
"retention_days": 123,
"retention_mode": "<string>",
"comment_on_github": true,
"clone_settings": {},
"tier": "hobby",
"size": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}Set the preview environment config
Creates the config the first time and updates it afterwards. Omitted fields keep their current value; on a first call they fall back to the defaults documented per field. Preview environments only work for applications deployed with the github method. While enabled, the resource they run on (resource_id, or the application’s own in parent mode) must accept the target project: a resource assigned to other projects is refused with 422. An application without a resource takes only parent mode. Saving the config enabled with preview environments that run without a resource prepares that placement at once: it is refused with 422 when Usage Billing is turned off for the workspace, or when the application or an add-on it clones needs more RAM or disk than a workload without a resource can have, and with 422 and checkout_url when the workspace has to pay the Usage Billing monthly minimum first. Turning on preview environments on Usage Billing, or moving them onto Usage Billing, takes apps:manage.
curl --request PUT \
--url https://app.miget.com/api/v1/apps/{uuid}/preview_environments/config \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"enabled": true,
"resource_id": "<string>",
"project_id": "<string>",
"trigger_label": "<string>",
"branch_pattern": "<string>",
"pr_name_pattern": "<string>",
"auto_deploy_on_push": true,
"cleanup_on_pr_merge": true,
"cleanup_on_pr_close": true,
"cleanup_on_branch_delete": true,
"cleanup_on_inactivity": true,
"inactivity_days": 123,
"retention_days": 123,
"comment_on_github": true,
"clone_settings": {},
"size": "<string>"
}
'import requests
url = "https://app.miget.com/api/v1/apps/{uuid}/preview_environments/config"
payload = {
"enabled": True,
"resource_id": "<string>",
"project_id": "<string>",
"trigger_label": "<string>",
"branch_pattern": "<string>",
"pr_name_pattern": "<string>",
"auto_deploy_on_push": True,
"cleanup_on_pr_merge": True,
"cleanup_on_pr_close": True,
"cleanup_on_branch_delete": True,
"cleanup_on_inactivity": True,
"inactivity_days": 123,
"retention_days": 123,
"comment_on_github": True,
"clone_settings": {},
"size": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
enabled: true,
resource_id: '<string>',
project_id: '<string>',
trigger_label: '<string>',
branch_pattern: '<string>',
pr_name_pattern: '<string>',
auto_deploy_on_push: true,
cleanup_on_pr_merge: true,
cleanup_on_pr_close: true,
cleanup_on_branch_delete: true,
cleanup_on_inactivity: true,
inactivity_days: 123,
retention_days: 123,
comment_on_github: true,
clone_settings: {},
size: '<string>'
})
};
fetch('https://app.miget.com/api/v1/apps/{uuid}/preview_environments/config', 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://app.miget.com/api/v1/apps/{uuid}/preview_environments/config",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'enabled' => true,
'resource_id' => '<string>',
'project_id' => '<string>',
'trigger_label' => '<string>',
'branch_pattern' => '<string>',
'pr_name_pattern' => '<string>',
'auto_deploy_on_push' => true,
'cleanup_on_pr_merge' => true,
'cleanup_on_pr_close' => true,
'cleanup_on_branch_delete' => true,
'cleanup_on_inactivity' => true,
'inactivity_days' => 123,
'retention_days' => 123,
'comment_on_github' => true,
'clone_settings' => [
],
'size' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://app.miget.com/api/v1/apps/{uuid}/preview_environments/config"
payload := strings.NewReader("{\n \"enabled\": true,\n \"resource_id\": \"<string>\",\n \"project_id\": \"<string>\",\n \"trigger_label\": \"<string>\",\n \"branch_pattern\": \"<string>\",\n \"pr_name_pattern\": \"<string>\",\n \"auto_deploy_on_push\": true,\n \"cleanup_on_pr_merge\": true,\n \"cleanup_on_pr_close\": true,\n \"cleanup_on_branch_delete\": true,\n \"cleanup_on_inactivity\": true,\n \"inactivity_days\": 123,\n \"retention_days\": 123,\n \"comment_on_github\": true,\n \"clone_settings\": {},\n \"size\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.put("https://app.miget.com/api/v1/apps/{uuid}/preview_environments/config")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"enabled\": true,\n \"resource_id\": \"<string>\",\n \"project_id\": \"<string>\",\n \"trigger_label\": \"<string>\",\n \"branch_pattern\": \"<string>\",\n \"pr_name_pattern\": \"<string>\",\n \"auto_deploy_on_push\": true,\n \"cleanup_on_pr_merge\": true,\n \"cleanup_on_pr_close\": true,\n \"cleanup_on_branch_delete\": true,\n \"cleanup_on_inactivity\": true,\n \"inactivity_days\": 123,\n \"retention_days\": 123,\n \"comment_on_github\": true,\n \"clone_settings\": {},\n \"size\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.miget.com/api/v1/apps/{uuid}/preview_environments/config")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"enabled\": true,\n \"resource_id\": \"<string>\",\n \"project_id\": \"<string>\",\n \"trigger_label\": \"<string>\",\n \"branch_pattern\": \"<string>\",\n \"pr_name_pattern\": \"<string>\",\n \"auto_deploy_on_push\": true,\n \"cleanup_on_pr_merge\": true,\n \"cleanup_on_pr_close\": true,\n \"cleanup_on_branch_delete\": true,\n \"cleanup_on_inactivity\": true,\n \"inactivity_days\": 123,\n \"retention_days\": 123,\n \"comment_on_github\": true,\n \"clone_settings\": {},\n \"size\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"enabled": true,
"resource_mode": "<string>",
"resource_id": "<string>",
"project_id": "<string>",
"trigger_mode": "<string>",
"trigger_filter": "<string>",
"trigger_label": "<string>",
"branch_pattern": "<string>",
"pr_name_pattern": "<string>",
"auto_deploy_on_push": true,
"cleanup_on_pr_merge": true,
"cleanup_on_pr_close": true,
"cleanup_on_branch_delete": true,
"cleanup_on_inactivity": true,
"inactivity_days": 123,
"retention_days": 123,
"retention_mode": "<string>",
"comment_on_github": true,
"clone_settings": {},
"tier": "hobby",
"size": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}Authorizations
Body
Set the preview environment config
parent runs them where the application runs: on its resource, or on Usage Billing or in the workspace pool in its region. existing requires resource_id. pay_per_use, or workspace_pool on an enterprise contract, runs the preview environments of an application on a resource without one, in the application's region. Without a resource they run at the CPU class and size set by dedicated and size, the application's until those are set. An application without a resource takes only parent. Defaults to parent
parent, existing, pay_per_use, workspace_pool For preview environments that run without a resource (pay_per_use, workspace_pool, or parent for an application without one): 'hobby' for shared CPU, 'pro' for dedicated. Implied by size when one is named. Until it is set they take the application's CPU class. Cloned add-ons keep the application's sizes and run in the same CPU class as the preview
hobby, pro Response
Set the preview environment config
Api_V1_Entities_PreviewEnvironmentConfig model

