Set a project's preview settings.
PUT
/api/v1/projects/{project}/previews/policy
const url = 'https://example.com/api/v1/projects/example/previews/policy';const options = { method: 'PUT', headers: {'Content-Type': 'application/json'}, body: '{"enabled":true,"sourceEnvironment":"staging","ttlHours":1,"maxActive":1,"allowForks":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://example.com/api/v1/projects/example/previews/policy \ --header 'Content-Type: application/json' \ --data '{ "enabled": true, "sourceEnvironment": "staging", "ttlHours": 1, "maxActive": 1, "allowForks": true }'Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”project
required
string
Project name
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
enabled
required
boolean
sourceEnvironment
required
string
Example
stagingttlHours
integer format: int32
maxActive
integer format: int32
allowForks
boolean
Responses
Section titled “Responses”Media typeapplication/json
object
enabled
required
boolean
sourceEnvironment
The environment whose Git-built apps previews copy.
string | null
ttlHours
required
integer format: int32
maxActive
required
integer format: int32
allowForks
required
Pull requests from forks get (untrusted) previews too.
boolean
updatedBy
string | null
updatedAt
string | null
Examplegenerated
{ "enabled": true, "sourceEnvironment": "example", "ttlHours": 1, "maxActive": 1, "allowForks": true, "updatedBy": "example", "updatedAt": "example"}Media typeapplication/json
Problem Details body.
object
code
required
Stable machine-readable code, e.g. forbidden.
string
title
required
Short human readable title.
string
status
required
HTTP status.
integer format: int32
detail
Details, if safe to expose.
string | null
Example
{ "code": "forbidden"}Media typeapplication/json
Problem Details body.
object
code
required
Stable machine-readable code, e.g. forbidden.
string
title
required
Short human readable title.
string
status
required
HTTP status.
integer format: int32
detail
Details, if safe to expose.
string | null
Example
{ "code": "forbidden"}