Write Byte Range
curl --request POST \
--url https://api.zerodrive.dev/v1/files/write-bytes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"path": "bin/blob.bin",
"content_base64": "<string>",
"offset": 0,
"truncate": false,
"expected_revision": 123,
"drive_id": "primary"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
path: 'bin/blob.bin',
content_base64: '<string>',
offset: 0,
truncate: false,
expected_revision: 123,
drive_id: 'primary'
})
};
fetch('https://api.zerodrive.dev/v1/files/write-bytes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.zerodrive.dev/v1/files/write-bytes"
payload = {
"path": "bin/blob.bin",
"content_base64": "<string>",
"offset": 0,
"truncate": False,
"expected_revision": 123,
"drive_id": "primary"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){}Write Byte Range
Patch up to 64 KiB of base64 bytes at an offset with optional optimistic concurrency check (expected_revision).
POST
https://api.zerodrive.dev
/
v1
/
files
/
write-bytes
Write Byte Range
curl --request POST \
--url https://api.zerodrive.dev/v1/files/write-bytes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"path": "bin/blob.bin",
"content_base64": "<string>",
"offset": 0,
"truncate": false,
"expected_revision": 123,
"drive_id": "primary"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
path: 'bin/blob.bin',
content_base64: '<string>',
offset: 0,
truncate: false,
expected_revision: 123,
drive_id: 'primary'
})
};
fetch('https://api.zerodrive.dev/v1/files/write-bytes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.zerodrive.dev/v1/files/write-bytes"
payload = {
"path": "bin/blob.bin",
"content_base64": "<string>",
"offset": 0,
"truncate": False,
"expected_revision": 123,
"drive_id": "primary"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){}Authorizations
Body
application/json
Response
Updated file revision and size
The response is of type object.

