Sorry, no results found for "".
Whether the call should immediately return a pending environment, or wait for the completion of the fork
Performing a fast fork reduces processing time, but it also prevents writing to the source environment during the process
Force the start of fast fork, even if there are collaborators editing some records
The ID of the forked environment
"my-sandbox-env"
Must be exactly "environment"
.
Returns a Job ID. You can then poll for the completion of the job that will eventually return a resource object of type environment
The response contains the ID of the asynchronous job that started:
POST https://site-api.datocms.com/environments/:environment_id/fork HTTP/1.1Authorization: Bearer YOUR-API-TOKENAccept: application/jsonX-Api-Version: 3Content-Type: application/vnd.api+json
{ "data": { "type": "environment", "id": "my-sandbox-env" }}
curl -g 'https://site-api.datocms.com/environments/:environment_id/fork' \ -X POST \ -H "Authorization: Bearer YOUR-API-TOKEN" \ -H "Accept: application/json" \ -H "X-Api-Version: 3" \ -H "Content-Type: application/vnd.api+json" \ --data-binary '{"data":{"type":"environment","id":"my-sandbox-env"}}'
await fetch("https://site-api.datocms.com/environments/:environment_id/fork", { method: "POST", headers: { Authorization: "Bearer YOUR-API-TOKEN", Accept: "application/json", "X-Api-Version": "3", "Content-Type": "application/vnd.api+json", }, body: JSON.stringify({ data: { type: "environment", id: "my-sandbox-env" } }),});
HTTP/1.1 202 AcceptedContent-Type: application/jsonCache-Control: cache-control: max-age=0, private, must-revalidateX-RateLimit-Limit: 30X-RateLimit-Remaining: 28
{ "data": { "type": "job", "id": "4235" }}
To get the asynchronous job result, poll the job result endpoint. While the task is in progress, the endpoint returns a 404
status code. When the job completes, the status changes to 200 OK
:
GET https://site-api.datocms.com/job-results/:job_result_id HTTP/1.1Authorization: Bearer YOUR-API-TOKENAccept: application/jsonX-Api-Version: 3
curl -g 'https://site-api.datocms.com/job-results/:job_result_id' \ \ -H "Authorization: Bearer YOUR-API-TOKEN" \ -H "Accept: application/json" \ -H "X-Api-Version: 3"
await fetch("https://site-api.datocms.com/job-results/:job_result_id", { headers: { Authorization: "Bearer YOUR-API-TOKEN", Accept: "application/json", "X-Api-Version": "3", },});
HTTP/1.1 200 OKContent-Type: application/jsonCache-Control: cache-control: max-age=0, private, must-revalidateX-RateLimit-Limit: 30X-RateLimit-Remaining: 28
{ "data": { "type": "job_result", "id": "34", "attributes": { "status": 200, "payload": { "data": { "type": "environment", "id": "main", "meta": { "status": "ready", "created_at": "2020-04-21T07:57:11.124Z", "read_only_mode": true, "last_data_change_at": "2020-04-21T07:57:11.124Z", "primary": true, "forked_from": "main" } } } } }}