Documentation
Bucket
Update Bucket

Update Bucket

PUT /bucket/:id

Update an existing bucket.

Request

METHOD: PUT

AUTHENTICATION: required

URL: https://api.jsonstorage.online/v1/bucket/:id

BODY:

Content-Type: application/json

  • title: string (required) - The title of the bucket.
  • documents_validation_schema: object (optional) - A schema for validation purposes that applies to all documents that have bucket_id set to this bucket. Learn More
  • documents_visibility: enum (private | public) (optional, defaults to private) - Visibility that applies to all documents that have bucket_id set to this bucket.
⚠️

Values defined for documents_validation_schema and documents_visibility will override any corresponding values set at the document level for validation_schema and visibility, respectively. This means that when creating or updating documents, if these global settings are provided, they will take precedence over any individual settings specified for each document.

Example Request
  curl -X PUT \
    -H "Content-Type: application/json" \
    -H "X-secret-key: YOUR_SECRET_KEY_HERE" \
    -d '{"documents_validation_schema":{"name":{"required":true,"message":"Name is required"}}}' \
    https://api.jsonstorage.online/v1/bucket/862976a2-0d02-4973-9cee-5d8841b42857

Response

  • Status: 200 OK
  • Body: JSON object containing the updated bucket.
Example Response
{
  "id": "862976a2-0d02-4973-9cee-5d8841b42857",
  "title": "New Bucket",
  "documents_validation_schema": {
    "name":{
      "required":true,
      "message":"Name is required"
    }
  },
  "documents_visibility": "private",
  "created_at": "2024-04-03T12:00:00Z"
}