Enable pipeline preview
Enable preview apps for a pipeline. When enabled, the pipeline can create ephemeral preview environments for pull requests. If the pipeline does not have a Git repository configured, you must provide a repo_url to connect one.
curl --request POST \
--url https://api.sevalla.com/v3/pipelines/{id}/preview/enable \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"repo_url": "https://github.com/user/repo",
"auto_create_app": false,
"delete_stale_apps": false,
"stale_app_days": 5
}
'import requests
url = "https://api.sevalla.com/v3/pipelines/{id}/preview/enable"
payload = {
"repo_url": "https://github.com/user/repo",
"auto_create_app": False,
"delete_stale_apps": False,
"stale_app_days": 5
}
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({
repo_url: 'https://github.com/user/repo',
auto_create_app: false,
delete_stale_apps: false,
stale_app_days: 5
})
};
fetch('https://api.sevalla.com/v3/pipelines/{id}/preview/enable', 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.sevalla.com/v3/pipelines/{id}/preview/enable",
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([
'repo_url' => 'https://github.com/user/repo',
'auto_create_app' => false,
'delete_stale_apps' => false,
'stale_app_days' => 5
]),
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.sevalla.com/v3/pipelines/{id}/preview/enable"
payload := strings.NewReader("{\n \"repo_url\": \"https://github.com/user/repo\",\n \"auto_create_app\": false,\n \"delete_stale_apps\": false,\n \"stale_app_days\": 5\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.sevalla.com/v3/pipelines/{id}/preview/enable")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"repo_url\": \"https://github.com/user/repo\",\n \"auto_create_app\": false,\n \"delete_stale_apps\": false,\n \"stale_app_days\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sevalla.com/v3/pipelines/{id}/preview/enable")
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 \"repo_url\": \"https://github.com/user/repo\",\n \"auto_create_app\": false,\n \"delete_stale_apps\": false,\n \"stale_app_days\": 5\n}"
response = http.request(request)
puts response.read_body{
"message": "Pipeline preview stage has been enabled"
}{
"message": "Bad request",
"status": 400,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Unauthorized",
"status": 401,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Forbidden",
"status": 403,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Not found",
"status": 404,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Too many requests",
"status": 429,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Internal Server Error",
"status": 500,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}Authorizations
API key authentication. Pass your API key as a Bearer token in the Authorization header.
Path Parameters
Pipeline identifier
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"fb5e5168-4281-4bec-94c5-0d1584e9e657"
Body
Git repository URL to connect to the pipeline. Required if the pipeline does not already have a repository configured.
"https://github.com/user/repo"
Automatically create a preview app when a pull request is opened
false
Automatically delete preview apps that have not been deployed for longer than the stale app threshold
false
Number of days after the last deployment before a preview app is considered stale
1 <= x <= 3655
Response
Default Response
Confirmation message
"Pipeline preview stage has been enabled"
Was this page helpful?
curl --request POST \
--url https://api.sevalla.com/v3/pipelines/{id}/preview/enable \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"repo_url": "https://github.com/user/repo",
"auto_create_app": false,
"delete_stale_apps": false,
"stale_app_days": 5
}
'import requests
url = "https://api.sevalla.com/v3/pipelines/{id}/preview/enable"
payload = {
"repo_url": "https://github.com/user/repo",
"auto_create_app": False,
"delete_stale_apps": False,
"stale_app_days": 5
}
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({
repo_url: 'https://github.com/user/repo',
auto_create_app: false,
delete_stale_apps: false,
stale_app_days: 5
})
};
fetch('https://api.sevalla.com/v3/pipelines/{id}/preview/enable', 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.sevalla.com/v3/pipelines/{id}/preview/enable",
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([
'repo_url' => 'https://github.com/user/repo',
'auto_create_app' => false,
'delete_stale_apps' => false,
'stale_app_days' => 5
]),
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.sevalla.com/v3/pipelines/{id}/preview/enable"
payload := strings.NewReader("{\n \"repo_url\": \"https://github.com/user/repo\",\n \"auto_create_app\": false,\n \"delete_stale_apps\": false,\n \"stale_app_days\": 5\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.sevalla.com/v3/pipelines/{id}/preview/enable")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"repo_url\": \"https://github.com/user/repo\",\n \"auto_create_app\": false,\n \"delete_stale_apps\": false,\n \"stale_app_days\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sevalla.com/v3/pipelines/{id}/preview/enable")
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 \"repo_url\": \"https://github.com/user/repo\",\n \"auto_create_app\": false,\n \"delete_stale_apps\": false,\n \"stale_app_days\": 5\n}"
response = http.request(request)
puts response.read_body{
"message": "Pipeline preview stage has been enabled"
}{
"message": "Bad request",
"status": 400,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Unauthorized",
"status": 401,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Forbidden",
"status": 403,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Not found",
"status": 404,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Too many requests",
"status": 429,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Internal Server Error",
"status": 500,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}