Onedata API Reference

REST API references for Onezone, Oneprovider, and Onepanel.

Update file content

PUT /data/{id}/content

Updates content of file specified by $FILE_ID. The offset query parameter can be used to start writing from a certain byte in the file, in such case the file is NOT truncated (bytes beyond the overwritten fragment will be preserved). If no offset query is given, the file is truncated and the previous file content is completely overwritten.

Example cURL requests

Update file content starting from specified offset:

# originally, the file content is  "abcdefghijklmno"

curl -H "X-Auth-Token: $TOKEN" \
-X PUT "https://$HOST/api/v3/oneprovider/data/$FILE_ID/content?offset=4" \
-H "Content-Type: application/octet-stream" -d "WXYZ"

# upon success, the file content is "abcdWXYZijklmno"

Path parameters

Parameter Type & Description
id required
string

Id of the file.

Query parameters

Parameter Type & Description
offset
integer

Offset at which data sent as request body should be written to file.

Request body

application/octet-stream

File content to be written at specified offset.

No schema provided.

Request Examples

Shell
cat new_content.txt | oneprovider-rest-cli updateFileContent id=$PARENT_ID -

Responses

application/json
204

File content updated successfully.

400

Invalid request.

Property
Type & Description
error
string

Identifier representing internal error code.

error_description
string

Detailed error message.

Example

application/json
{
  "error": "invalid_token",
  "error_description": "Provided token could not be validated."
}
403

Forbidden request.

Property
Type & Description
error
string

Identifier representing internal error code.

error_description
string

Detailed error message.

Example

application/json
{
  "error": "invalid_token",
  "error_description": "Provided token could not be validated."
}
404

File not found.

Property
Type & Description
error
string

Identifier representing internal error code.

error_description
string

Detailed error message.

Example

application/json
{
  "error": "invalid_token",
  "error_description": "Provided token could not be validated."
}
500

Internal server error.

Property
Type & Description
error
string

Identifier representing internal error code.

error_description
string

Detailed error message.

Example

application/json
{
  "error": "invalid_token",
  "error_description": "Provided token could not be validated."
}