Update a file
Data Ocean supports modifications to file attributes and basic file versioning.
The attributes are updated using a PATCH request and passing the attributes you want to change in the body.
The file content is updated by creating a new version. The version is an updated file that is referenced as the current file version. Other versions are stored in Data Ocean for reference.
Update file attributes
Using the update file by ID API Call to change file attributes:
PATCH {base URL}/api/files/{id}The following attributes can be updated. The new values will overwrite the existing attribute values. To update, include the attributes in your request body:
- metadata
- path (to change directory or name)
You cannot change the public/private status on an existing file. To change the status, upload a new version using the restricted_access parameter.
Updating file content (version)
Data Ocean keeps each file loaded as a version of the original file grouped under the same file ID. It does not support individual changes on content within a file.
To create a new file version, follow the procedures in Upload a file. Use the path for the file you are updating.
In a new version, include all attributes you would like associated with the file. This file does not inherit any attributes (location, permissions, etc.) from the original file. To download specific versions, send the version information in the request (for example, /files/path/{file_path}:versions/{version_number}).
The newest version is considered the current file associated with a file path and ID and is retrieved when the file path or ID is used.
Reference Materials