Restore an attachment version
curl --request POST \
--url https://api.zerogen.com/v1/projects/{projectId}/attachments/{attachmentId}/restore \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"version": 1,
"expectedVersion": 3
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({version: 1, expectedVersion: 3})
};
fetch('https://api.zerogen.com/v1/projects/{projectId}/attachments/{attachmentId}/restore', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.zerogen.com/v1/projects/{projectId}/attachments/{attachmentId}/restore"
payload = {
"version": 1,
"expectedVersion": 3
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": 123,
"restoredFrom": 123,
"outcome": "restored"
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {
"reason": "<string>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {
"reason": "<string>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {
"reason": "<string>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {
"reason": "<string>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {
"reason": "<string>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {
"reason": "<string>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {
"reason": "<string>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {
"reason": "<string>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {
"reason": "<string>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {
"reason": "<string>"
}
}
}Attachments
Restore an attachment version
Copy a saved version’s full state into a new version and clear deletion. expectedVersion is the current head, including a deletion version. A state already current and live returns unchanged when expectedVersion is at most the current head; a future version is refused. Restoring a deletion counts toward the parent’s 10 live attachments. Requires attachments enabled and a live parent; test keys are refused.
Needs the library:organize and library:read scopes.
POST
/
projects
/
{projectId}
/
attachments
/
{attachmentId}
/
restore
Restore an attachment version
curl --request POST \
--url https://api.zerogen.com/v1/projects/{projectId}/attachments/{attachmentId}/restore \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"version": 1,
"expectedVersion": 3
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({version: 1, expectedVersion: 3})
};
fetch('https://api.zerogen.com/v1/projects/{projectId}/attachments/{attachmentId}/restore', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.zerogen.com/v1/projects/{projectId}/attachments/{attachmentId}/restore"
payload = {
"version": 1,
"expectedVersion": 3
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": 123,
"restoredFrom": 123,
"outcome": "restored"
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {
"reason": "<string>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {
"reason": "<string>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {
"reason": "<string>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {
"reason": "<string>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {
"reason": "<string>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {
"reason": "<string>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {
"reason": "<string>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {
"reason": "<string>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {
"reason": "<string>"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"retryable": true,
"param": "<string>",
"details": {
"reason": "<string>"
}
}
}Authorizations
Headers
Body
application/json
Response
The restored version and the historical version copied.