Update a file
Requires scope `files:update`. PAT only; browser sessions are rejected. Returns `409` (`details.reason: file_deleted`) when the file was deleted. A token that registered a watcher may act only on instruments whose active watcher it registered, and gets 403 for any other.
Requires scope files:update. PAT only; browser sessions are rejected. Returns 409 (details.reason: file_deleted) when the file was deleted. A token that registered a watcher may act only on instruments whose active watcher it registered, and gets 403 for any other.
Authorization
bearerAuth Personal access tokens begin with dhub_… and are restricted by their assigned scopes.
In: header
Path Parameters
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X PATCH "https://example.com/files/1" \ -H "Content-Type: application/json" \ -d '{}'{ "id": 0, "instrument_run_id": "09e81fd0-3875-4ea7-a8b5-166f38633c23", "filename": "string", "relative_path": "string", "s3_bucket": "string", "s3_key": "string", "content_type": "string", "size_bytes": 0, "category": "raw", "status": "detected", "metadata": { "property1": null, "property2": null }, "error_message": "string", "detected_at": "2019-08-24T14:15:22Z", "upload_requested_at": "2019-08-24T14:15:22Z", "uploaded_at": "2019-08-24T14:15:22Z", "processed_at": "2019-08-24T14:15:22Z", "processing_started_at": "2019-08-24T14:15:22Z", "created_at": "2019-08-24T14:15:22Z", "file_created_at": "2019-08-24T14:15:22Z", "deleted_at": "2019-08-24T14:15:22Z"}{ "error": { "code": "string", "message": "string", "details": { "property1": null, "property2": null } }}{ "error": { "code": "string", "message": "string", "details": { "property1": null, "property2": null } }}{ "error": { "code": "string", "message": "string", "details": { "property1": null, "property2": null } }}{ "error": { "code": "string", "message": "string", "details": { "property1": null, "property2": null } }}{ "error": { "code": "string", "message": "string", "details": { "property1": null, "property2": null } }}Create a run file record POST
Requires scope `files:create`. PAT only; browser sessions are rejected. A token that registered a watcher may act only on instruments whose active watcher it registered, and gets 403 for any other. The location must be the file's own: `s3_key` must be `<instrumentId>/<runId>/<filename>`, using the run ID as stored, `filename` can't contain `/`, and `s3_bucket` must be Data Hub's raw bucket for a `raw` file or its processed bucket for a `processed` one. Any other location gets `400`. `source_file_id` is for a `processed` file and names the raw file of this run that it was made from; any other value gets `400`. An existing processed file that has no source yet is linked to it; one that has a source keeps it. A processed file made from a deleted raw file is saved deleted, and when the key belongs to a deleted processed file, that file is saved again as the new output. `409` means the run is deleted, or another file already uses that key or path.
Delete a file DELETE
Requires scope `files:delete`. Deletes the file from its run, whether or not it was uploaded. The file stays in storage, its row records who deleted it, and `POST /files/{fileId}/restore` brings it back. Deleted files are left out of the run's file lists and downloads. Pass `include_linked=true` to delete the files linked to it too: for a raw file, the processed files made from it and the `run.json` saved with its capture when every raw file in that folder is being deleted. `linked` lists them. Returns `409` while the file is queued or processing, unless its processing has stalled (wait for processing to finish), and `409` (`details.reason: run_deleted`) when the run was deleted. Deleting a file that is already deleted succeeds with `already_applied: true`. A token that registered a watcher may act only on instruments whose active watcher it registered, and gets 403 for any other.