Skip to content

Restore environment unified model mapping version

POST /environment-unified-model-resource-method/{id}/versions/{version}/restore

Saves an older version's content as a new version. History is never rewound: restoring version 3 of a environment unified model mapping at version 7 creates version 8, recorded with source: restore and restored_from_version: 3.

The save goes through PATCH /environment-unified-model-resource-method/{id} as the caller, so it has the same permission checks, validation, webhooks and response as any other save. A refusal from that route is returned as is.

Versions hold no secrets, and a restore keeps the secrets stored today. A *_secret environment variable that is no longer stored is left out. A version whose credentials (a client ID, a signing key ID, or a token URL) differ from today's is refused with 400, because today's secret would be paired with them. So is a version that has no value for a field a save cannot clear.

Path Parameters

idstring
required·

The object's ID.

versioninteger
required

Request Body

change_messagestring

Why the version is being restored. Recorded with the new version.

expected_current_versioninteger

The version the caller believes is current, as current_version in the listing. When the object has moved on since, the restore is refused with 409 and nothing is saved.

Errors

StatusDescription
400The version matches the current configuration, so restoring it would change nothing; its credentials differ from today's; it has no value for a field a save cannot clear; or the body is invalid. Also any refusal from the PATCH route.
404No such environment unified model mapping or version, or the caller cannot edit the environment unified model mapping.
409expected_current_version is not the environment unified model mapping's current version: it changed since the caller read its history.
curl -X POST 'https://api.truto.one/environment-unified-model-resource-method/{id}/versions/{version}/restore' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "change_message": "your_change_message",
  "expected_current_version": 0
}'
const body = {
  "change_message": "your_change_message",
  "expected_current_version": 0
};

const response = await fetch('https://api.truto.one/environment-unified-model-resource-method/{id}/versions/{version}/restore', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
import requests

url = "https://api.truto.one/environment-unified-model-resource-method/{id}/versions/{version}/restore"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}
payload = {
    "change_message": "your_change_message",
    "expected_current_version": 0
}

response = requests.post(url, headers=headers, params=params, json=payload)
print(response.json())