Edit regions
curl --request PATCH \
--url https://api.relettr.com/v1/chapters/{chapter_id}/regions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'If-Match: <if-match>' \
--data '
{
"edits": [
{
"id": "p03r012",
"en": "Stay behind me."
},
{
"id": "p03r013",
"include": false
}
]
}
'import requests
url = "https://api.relettr.com/v1/chapters/{chapter_id}/regions"
payload = { "edits": [
{
"id": "p03r012",
"en": "Stay behind me."
},
{
"id": "p03r013",
"include": False
}
] }
headers = {
"If-Match": "<if-match>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'If-Match': '<if-match>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
edits: [{id: 'p03r012', en: 'Stay behind me.'}, {id: 'p03r013', include: false}]
})
};
fetch('https://api.relettr.com/v1/chapters/{chapter_id}/regions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"dirty_parts": [
123
]
}{
"error": {
"type": "invalid_request",
"code": "parameter_invalid",
"message": "<string>",
"request_id": "<string>",
"param": "files[3].content_type",
"doc_url": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "parameter_invalid",
"message": "<string>",
"request_id": "<string>",
"param": "files[3].content_type",
"doc_url": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "parameter_invalid",
"message": "<string>",
"request_id": "<string>",
"param": "files[3].content_type",
"doc_url": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "parameter_invalid",
"message": "<string>",
"request_id": "<string>",
"param": "files[3].content_type",
"doc_url": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "parameter_invalid",
"message": "<string>",
"request_id": "<string>",
"param": "files[3].content_type",
"doc_url": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "parameter_invalid",
"message": "<string>",
"request_id": "<string>",
"param": "files[3].content_type",
"doc_url": "<string>"
}
}Regions and review
Edit regions
Batch edit ko, en, type and include. Requires If-Match with
the ETag from GET /regions; a stale ETag returns
412 precondition_failed, so two editors never overwrite each other.
Returns the list of parts that need a re-render. Nothing is rendered
until you call POST /rerender.
PATCH
/
chapters
/
{chapter_id}
/
regions
Edit regions
curl --request PATCH \
--url https://api.relettr.com/v1/chapters/{chapter_id}/regions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'If-Match: <if-match>' \
--data '
{
"edits": [
{
"id": "p03r012",
"en": "Stay behind me."
},
{
"id": "p03r013",
"include": false
}
]
}
'import requests
url = "https://api.relettr.com/v1/chapters/{chapter_id}/regions"
payload = { "edits": [
{
"id": "p03r012",
"en": "Stay behind me."
},
{
"id": "p03r013",
"include": False
}
] }
headers = {
"If-Match": "<if-match>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'If-Match': '<if-match>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
edits: [{id: 'p03r012', en: 'Stay behind me.'}, {id: 'p03r013', include: false}]
})
};
fetch('https://api.relettr.com/v1/chapters/{chapter_id}/regions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"dirty_parts": [
123
]
}{
"error": {
"type": "invalid_request",
"code": "parameter_invalid",
"message": "<string>",
"request_id": "<string>",
"param": "files[3].content_type",
"doc_url": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "parameter_invalid",
"message": "<string>",
"request_id": "<string>",
"param": "files[3].content_type",
"doc_url": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "parameter_invalid",
"message": "<string>",
"request_id": "<string>",
"param": "files[3].content_type",
"doc_url": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "parameter_invalid",
"message": "<string>",
"request_id": "<string>",
"param": "files[3].content_type",
"doc_url": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "parameter_invalid",
"message": "<string>",
"request_id": "<string>",
"param": "files[3].content_type",
"doc_url": "<string>"
}
}{
"error": {
"type": "invalid_request",
"code": "parameter_invalid",
"message": "<string>",
"request_id": "<string>",
"param": "files[3].content_type",
"doc_url": "<string>"
}
}