'Generic Commit'
Some checks failed
Build-Test-Publish / Build (push) Failing after 1m47s

This commit is contained in:
Your Name
2025-06-02 00:27:48 +12:00
parent 4259f6d960
commit d8e15f3f19
6 changed files with 141 additions and 0 deletions

View File

@@ -120,6 +120,47 @@ curl -X PUT \
http://localhost:8080/upload
```
### PUT /update
Update the metadata for an existing object. The request must be authenticated with a valid write token. The request body must be JSON and include both a `hash` (the object's hash) and a `metadata` object.
**Request:**
- Method: PUT
- URL: /update
- Headers:
- Authorization: Bearer <WRITE_TOKEN>
- Content-Type: application/json
- Body:
```json
{
"hash": "<object_hash>",
"metadata": {
"key1": "value1",
"key2": "value2"
}
}
```
**Response:**
- 200 OK on success:
```json
{
"result": "success",
"hash": "<object_hash>"
}
```
- 400 Bad Request if missing fields or invalid JSON
- 404 Not Found if the object does not exist
- 401/403 if authentication fails
**Example:**
```sh
curl -X PUT http://localhost:8080/update \
-H "Authorization: Bearer <WRITE_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"hash": "abc123", "metadata": {"foo": "bar"}}'
```
### Get a File
```