curl --request POST \
--url https://eu.phrase.com/connectors/contentful2/v1/sync/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"connectorUuid": "4282fec0-d2e9-4266-8733-3e634feb7b59",
"configuration": {
"previewUrl": "https://example.com/preview/{space_id}/{env_id}/{entry_id}"
},
"path": {
"pathType": "ENTRY",
"spaceId": "space-1",
"environmentId": "master",
"entryId": "entry-1"
}
}
'import requests
url = "https://eu.phrase.com/connectors/contentful2/v1/sync/preview"
payload = {
"connectorUuid": "4282fec0-d2e9-4266-8733-3e634feb7b59",
"configuration": { "previewUrl": "https://example.com/preview/{space_id}/{env_id}/{entry_id}" },
"path": {
"pathType": "ENTRY",
"spaceId": "space-1",
"environmentId": "master",
"entryId": "entry-1"
}
}
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({
connectorUuid: '4282fec0-d2e9-4266-8733-3e634feb7b59',
configuration: {previewUrl: 'https://example.com/preview/{space_id}/{env_id}/{entry_id}'},
path: {
pathType: 'ENTRY',
spaceId: 'space-1',
environmentId: 'master',
entryId: 'entry-1'
}
})
};
fetch('https://eu.phrase.com/connectors/contentful2/v1/sync/preview', 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://eu.phrase.com/connectors/contentful2/v1/sync/preview",
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([
'connectorUuid' => '4282fec0-d2e9-4266-8733-3e634feb7b59',
'configuration' => [
'previewUrl' => 'https://example.com/preview/{space_id}/{env_id}/{entry_id}'
],
'path' => [
'pathType' => 'ENTRY',
'spaceId' => 'space-1',
'environmentId' => 'master',
'entryId' => 'entry-1'
]
]),
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://eu.phrase.com/connectors/contentful2/v1/sync/preview"
payload := strings.NewReader("{\n \"connectorUuid\": \"4282fec0-d2e9-4266-8733-3e634feb7b59\",\n \"configuration\": {\n \"previewUrl\": \"https://example.com/preview/{space_id}/{env_id}/{entry_id}\"\n },\n \"path\": {\n \"pathType\": \"ENTRY\",\n \"spaceId\": \"space-1\",\n \"environmentId\": \"master\",\n \"entryId\": \"entry-1\"\n }\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://eu.phrase.com/connectors/contentful2/v1/sync/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"connectorUuid\": \"4282fec0-d2e9-4266-8733-3e634feb7b59\",\n \"configuration\": {\n \"previewUrl\": \"https://example.com/preview/{space_id}/{env_id}/{entry_id}\"\n },\n \"path\": {\n \"pathType\": \"ENTRY\",\n \"spaceId\": \"space-1\",\n \"environmentId\": \"master\",\n \"entryId\": \"entry-1\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://eu.phrase.com/connectors/contentful2/v1/sync/preview")
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 \"connectorUuid\": \"4282fec0-d2e9-4266-8733-3e634feb7b59\",\n \"configuration\": {\n \"previewUrl\": \"https://example.com/preview/{space_id}/{env_id}/{entry_id}\"\n },\n \"path\": {\n \"pathType\": \"ENTRY\",\n \"spaceId\": \"space-1\",\n \"environmentId\": \"master\",\n \"entryId\": \"entry-1\"\n }\n}"
response = http.request(request)
puts response.read_body""""Generate preview package synchronously
Generate the live preview package of a Contentful entry: the entry rendered by the website preview URL configured in configuration.previewUrl.
The connector stores the preview as a zip package (index.html in the root, referenced assets
under assets/) in Phrase file storage. path must be an ENTRY path (spaceId, environmentId, entryId). Any other path type yields no preview.
Choosing sync vs async
/sync/previewblocks until the connector finishes. Subject to gateway timeouts (~60 s)./async/previewreturns immediately with arequestIdand posts the result to the URL inX-Webhookwhen ready.
Response shape (sync only) is controlled by X-ResponseType:
ID(default) — JSON{ "storageId": "..." }. The caller downloads the zip package from Phrase file storage.OBJECT— the zip package itself asapplication/octet-stream.
No preview available. When the connector cannot produce a preview for the requested item,
the call still succeeds (HTTP 200) with the JSON body { "available": false, "message": "..." },
whatever X-ResponseType is. For the async variant the same body is POSTed to the webhook.
curl --request POST \
--url https://eu.phrase.com/connectors/contentful2/v1/sync/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"connectorUuid": "4282fec0-d2e9-4266-8733-3e634feb7b59",
"configuration": {
"previewUrl": "https://example.com/preview/{space_id}/{env_id}/{entry_id}"
},
"path": {
"pathType": "ENTRY",
"spaceId": "space-1",
"environmentId": "master",
"entryId": "entry-1"
}
}
'import requests
url = "https://eu.phrase.com/connectors/contentful2/v1/sync/preview"
payload = {
"connectorUuid": "4282fec0-d2e9-4266-8733-3e634feb7b59",
"configuration": { "previewUrl": "https://example.com/preview/{space_id}/{env_id}/{entry_id}" },
"path": {
"pathType": "ENTRY",
"spaceId": "space-1",
"environmentId": "master",
"entryId": "entry-1"
}
}
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({
connectorUuid: '4282fec0-d2e9-4266-8733-3e634feb7b59',
configuration: {previewUrl: 'https://example.com/preview/{space_id}/{env_id}/{entry_id}'},
path: {
pathType: 'ENTRY',
spaceId: 'space-1',
environmentId: 'master',
entryId: 'entry-1'
}
})
};
fetch('https://eu.phrase.com/connectors/contentful2/v1/sync/preview', 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://eu.phrase.com/connectors/contentful2/v1/sync/preview",
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([
'connectorUuid' => '4282fec0-d2e9-4266-8733-3e634feb7b59',
'configuration' => [
'previewUrl' => 'https://example.com/preview/{space_id}/{env_id}/{entry_id}'
],
'path' => [
'pathType' => 'ENTRY',
'spaceId' => 'space-1',
'environmentId' => 'master',
'entryId' => 'entry-1'
]
]),
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://eu.phrase.com/connectors/contentful2/v1/sync/preview"
payload := strings.NewReader("{\n \"connectorUuid\": \"4282fec0-d2e9-4266-8733-3e634feb7b59\",\n \"configuration\": {\n \"previewUrl\": \"https://example.com/preview/{space_id}/{env_id}/{entry_id}\"\n },\n \"path\": {\n \"pathType\": \"ENTRY\",\n \"spaceId\": \"space-1\",\n \"environmentId\": \"master\",\n \"entryId\": \"entry-1\"\n }\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://eu.phrase.com/connectors/contentful2/v1/sync/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"connectorUuid\": \"4282fec0-d2e9-4266-8733-3e634feb7b59\",\n \"configuration\": {\n \"previewUrl\": \"https://example.com/preview/{space_id}/{env_id}/{entry_id}\"\n },\n \"path\": {\n \"pathType\": \"ENTRY\",\n \"spaceId\": \"space-1\",\n \"environmentId\": \"master\",\n \"entryId\": \"entry-1\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://eu.phrase.com/connectors/contentful2/v1/sync/preview")
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 \"connectorUuid\": \"4282fec0-d2e9-4266-8733-3e634feb7b59\",\n \"configuration\": {\n \"previewUrl\": \"https://example.com/preview/{space_id}/{env_id}/{entry_id}\"\n },\n \"path\": {\n \"pathType\": \"ENTRY\",\n \"spaceId\": \"space-1\",\n \"environmentId\": \"master\",\n \"entryId\": \"entry-1\"\n }\n}"
response = http.request(request)
puts response.read_body""""Authorizations
IDM-issued JWT. Obtain via the IDM authentication flow and pass as: Bearer
Headers
A logging ID of the request. It is propagated through Phrase systems, making it easier to connect logs from various services. If no ActionId is sent with a request, one will be generated by Bifrost and returned with the response.
Specify if the response should contain the processed object itself in an application/octet-stream body, or a application/json body with an ID that can be then used to retrieve the object using a /load-content endpoint. Note that for larger files (> 1 MB), it is advised to use the ID option which is also default. (ID => JSON with storageId of the zip package, OBJECT => the zip package as binary stream).
ID, OBJECT Body
Request body for generating the live preview package of a Contentful entry. The connector loads its credentials from TMS using the supplied connectorUuid.
UUID of a connector instance configured in TMS.
"4282fec0-d2e9-4266-8733-3e634feb7b59"
The Contentful entry to preview (ENTRY path). Any other path type yields no preview.
- Option 1
- Option 2
Show child attributes
Show child attributes
Contentful-specific behavior knobs (tag filter, reference inlining, asset handling, …).
Show child attributes
Show child attributes
Response
OK — the preview package (zip) as a binary stream (returned when X-ResponseType=OBJECT).
The response is of type file.
Was this page helpful?