Preview
Preview configuration object
Specifies how preview is set up in a given environment. This means the definitions of space domains and preview URLs for specific content types.
space_domains[]required · array · unique items
The space domains configured in your environment.
Show child attributes
preview_url_patterns[]required · array · unique items
List of preview URLs, that is a combination of a space and URL pattern, for specific content types.
Show child attributes
JSON
{
"space_domains": [
{
"space": {
"id": "fb2c6c2b-fb79-4d1b-856a-b59762e304b0"
},
"domain": "www.mysite1.com"
},
{
"space": {
"id": "24dace50-3cf6-4378-8704-453af9cdb60c"
},
"domain": "www.mysite2.com"
}
],
"preview_url_patterns": [
{
"content_type": {
"id": "cf75f19d-6ed4-4820-a541-cde50dd79054"
},
"url_patterns": [
{
"space": {
"id": "24dace50-3cf6-4378-8704-453af9cdb60c"
},
"url_pattern": "https://{Space}/{Lang}/articles/history/"
}
]
},
{
"content_type": {
"id": "f21f6c3b-f63e-4aa1-866f-55fd85ad262e"
},
"url_patterns": [
{
"space": null,
"url_pattern": "https://www.mysite1.com/{Lang}/articles/"
}
]
}
]
}Retrieve preview configuration
View the complete preview URLs configuration for the specified environment.
GET
https://manage.kontent.ai/v2/projects/{environment_id}/preview-configurationRequest
Path parameters
environment_idrequired · string
Identifies your environment.
Request samples
C#
cURL
// Tip: Find more about .NET SDKs at https://kontent.ai/learn/net
using Kontent.Ai.Management;
var client = new ManagementClient(new ManagementOptions
{
ApiKey = "KONTENT_AI_MANAGEMENT_API_KEY",
EnvironmentId = "KONTENT_AI_ENVIRONMENT_ID"
});
var response = await client.GetPreviewConfigurationAsync()
Response
Status (200)
The complete preview URLs configuration for the specified environment.
space_domains[]required · array · unique items
The space domains configured in your environment.
Show child attributes
preview_url_patterns[]required · array · unique items
List of preview URLs, that is a combination of a space and URL pattern, for specific content types.
Show child attributes
Example responses
200
{
"space_domains": [
{
"space": {
"id": "fb2c6c2b-fb79-4d1b-856a-b59762e304b0"
},
"domain": "www.mysite1.com"
},
{
"space": {
"id": "24dace50-3cf6-4378-8704-453af9cdb60c"
},
"domain": "www.mysite2.com"
}
],
"preview_url_patterns": [
{
"content_type": {
"id": "cf75f19d-6ed4-4820-a541-cde50dd79054"
},
"url_patterns": [
{
"space": {
"id": "24dace50-3cf6-4378-8704-453af9cdb60c"
},
"url_pattern": "https://{Space}/{Lang}/articles/history/"
}
]
},
{
"content_type": {
"id": "f21f6c3b-f63e-4aa1-866f-55fd85ad262e"
},
"url_patterns": [
{
"space": null,
"url_pattern": "https://www.mysite1.com/{Lang}/articles/"
}
]
}
]
}Modify preview configuration
Adjust the preview URLs configured for your environment.
PUT
https://manage.kontent.ai/v2/projects/{environment_id}/preview-configurationRequest
Path parameters
environment_idrequired · string
Identifies your environment.
Body schema
Application/json
The preview configuration you want to use.
space_domains[]required · array · unique items
The space domains configured in your environment.
Show child attributes
preview_url_patterns[]required · array · unique items
List of preview URLs, that is a combination of a space and URL pattern, for specific content types.
Show child attributes
Request samples
C#
cURL
// Tip: Find more about .NET SDKs at https://kontent.ai/learn/net
using Kontent.Ai.Management;
var client = new ManagementClient(new ManagementOptions
{
ApiKey = "KONTENT_AI_MANAGEMENT_API_KEY",
EnvironmentId = "KONTENT_AI_ENVIRONMENT_ID"
});
var response = await client.UpdatePreviewConfigurationAsync(new PreviewConfigurationModel()
{
SpaceDomains = new List<SpaceDomainModel>
{
new()
{
Domain = "www.mysite.com",
Space = Reference.ByCodename("my_space")
}
},
PreviewUrlPatterns = new List<TypePreviewUrlPatternModel>
{
new()
{
ContentType = Reference.ByCodename("article"),
UrlPatterns = new List<PreviewUrlPatternModel>
{
new()
{
Space = null,
UrlPattern = "https://www.globalsite.com/{URLSlug}"
},
new()
{
Space = Reference.ByCodename("my_space"),
UrlPattern = "https://{Space}/{URLSlug}/test"
},
}
}
}
}
);
Response
Status (200)
The modified preview configuration.
space_domains[]required · array · unique items
The space domains configured in your environment.
Show child attributes
preview_url_patterns[]required · array · unique items
List of preview URLs, that is a combination of a space and URL pattern, for specific content types.
Show child attributes
Example responses
200
{
"space_domains": [
{
"space": {
"id": "fb2c6c2b-fb79-4d1b-856a-b59762e304b0"
},
"domain": "www.mysite1.com"
},
{
"space": {
"id": "24dace50-3cf6-4378-8704-453af9cdb60c"
},
"domain": "www.mysite2.com"
}
],
"preview_url_patterns": [
{
"content_type": {
"id": "cf75f19d-6ed4-4820-a541-cde50dd79054"
},
"url_patterns": [
{
"space": {
"id": "24dace50-3cf6-4378-8704-453af9cdb60c"
},
"url_pattern": "https://{Space}/{Lang}/articles/history/"
}
]
},
{
"content_type": {
"id": "f21f6c3b-f63e-4aa1-866f-55fd85ad262e"
},
"url_patterns": [
{
"space": null,
"url_pattern": "https://www.mysite1.com/{Lang}/articles/"
}
]
}
]
}Get status of live preview
Retrieve the current status of the live preview in the specified environment.
This endpoint requires API keys with Manage environments permission or a project manager's personal API key.
GET
https://manage.kontent.ai/v2/projects/{environment_id}/live-preview-configurationRequest
Path parameters
environment_idrequired · string
Identifies your environment.
Request samples
cURL
curl --request GET \
--url https://manage.kontent.ai/v2/projects/KONTENT_AI_ENVIRONMENT_ID/live-preview-configuration \
--header 'Authorization: Bearer KONTENT_AI_MANAGEMENT_API_KEY' \
--header 'Content-type: application/json'
Response
Status (200)
The environment's live preview status.
statusrequired · string
Informs what is the live preview's status in the specified environment.
Example responses
200
403
{
"status": "enabled"
}Change live preview status
Change the status of the live preview to enabled or disabled for the specified environment.
This endpoint requires API keys with Manage environments permission or a project manager's personal API key.
PUT
https://manage.kontent.ai/v2/projects/{environment_id}/live-preview-configurationRequest
Path parameters
environment_idrequired · string
Identifies your environment.
Body schema
Application/json
Specify if you want to enable or disable the live Preview feature.
statusrequired · string
Informs what is the live preview's status in the specified environment.
Request samples
cURL
curl --request PUT \
--url https://manage.kontent.ai/v2/projects/KONTENT_AI_ENVIRONMENT_ID/live-preview-configuration \
--header 'Authorization: Bearer KONTENT_AI_MANAGEMENT_API_KEY' \
--header 'Content-type: application/json'
--data '
{
"status": "enabled"
}'
Response
Status (200)
The environment's live preview status.
statusrequired · string
Informs what is the live preview's status in the specified environment.
Example responses
200
403
{
"status": "enabled"
}