Skip to main content

PUT /resources/

Completely replaces a resource with new data. All fields must be provided.

Authentication

This endpoint requires authentication.

Path Parameters

resource_id
string
required
The unique identifier of the resource to update (MongoDB ObjectId format)

Request Body

wrapper_id
string
required
ID of the wrapper to associate with this resource
name
string
required
Name of the resource
type
string
required
Type of the resource

Response

Returns the updated resource object.
id
string
required
Unique identifier for the resource (MongoDB ObjectId)
wrapper_id
string
required
ID of the wrapper associated with this resource
name
string
required
Name of the resource
type
string
required
Type of the resource
startPeriod
datetime
Start period timestamp for the resource
endPeriod
datetime
End period timestamp for the resource

Example Request

curl -X PUT "https://api.example.com/resources/507f1f77bcf86cd799439011" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "wrapper_id": "wrapper_123",
    "name": "Production Database - Updated",
    "type": "postgresql"
  }'

Example Response

{
  "id": "507f1f77bcf86cd799439011",
  "wrapper_id": "wrapper_123",
  "name": "Production Database - Updated",
  "type": "postgresql",
  "startPeriod": "2024-01-15T10:30:00Z",
  "endPeriod": null
}

PATCH /resources/

Partially updates a resource. Only the fields provided in the request body will be updated.

Authentication

This endpoint requires authentication.

Path Parameters

resource_id
string
required
The unique identifier of the resource to update (MongoDB ObjectId format)

Request Body

name
string
Name of the resource
type
string
Type of the resource

Response

Returns the updated resource object.
id
string
required
Unique identifier for the resource (MongoDB ObjectId)
wrapper_id
string
required
ID of the wrapper associated with this resource
name
string
required
Name of the resource
type
string
required
Type of the resource
startPeriod
datetime
Start period timestamp for the resource
endPeriod
datetime
End period timestamp for the resource

Example Request

curl -X PATCH "https://api.example.com/resources/507f1f77bcf86cd799439011" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production Database - Patched"
  }'

Example Response

{
  "id": "507f1f77bcf86cd799439011",
  "wrapper_id": "wrapper_123",
  "name": "Production Database - Patched",
  "type": "database",
  "startPeriod": "2024-01-15T10:30:00Z",
  "endPeriod": null
}

Error Responses (Both PUT and PATCH)

400
Bad Request
Invalid resource ID format
{
  "detail": "Invalid resource ID"
}
404
Not Found
Resource not found or has been deleted
{
  "detail": "Resource not found"
}
422
Validation Error
Invalid request body (missing required fields for PUT or incorrect types)
{
  "detail": [
    {
      "loc": ["body", "name"],
      "msg": "field required",
      "type": "value_error.missing"
    }
  ]
}
500
Internal Server Error
Database operation failed
{
  "detail": "Internal server error"
}

Build docs developers (and LLMs) love