This commit is contained in:
41
README.md
41
README.md
@@ -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
|
||||
|
||||
```
|
||||
|
Reference in New Issue
Block a user