Overview
Resources represent sustainability indicators in the system. Each resource is linked to a wrapper that fetches and processes data. This guide covers the complete lifecycle of resource management.Creating a Resource
Resources are typically auto-created when you generate a wrapper, but you can also create them manually.Automatic Resource Creation
When generating a wrapper withauto_create_resource: true (the default), the system automatically creates a resource:
The resource is created with type
sustainability_indicator and linked to the wrapper via wrapper_id.Manual Resource Creation
Create a resource manually by providing the wrapper ID:Retrieving Resources
Get All Resources
List resources with pagination support:Get Resource by ID
Retrieve a specific resource:Updating Resources
Full Update (PUT)
Replace all resource fields:Partial Update (PATCH)
Update specific fields only:PATCH allows you to update only the fields you specify, while PUT requires all fields.
Deleting Resources
Deleting a resource performs a soft delete and stops the associated wrapper:Wrapper is Stopped
The system automatically stops the wrapper process associated with this resource.
Resource Lifecycle
Data Collection
The wrapper executes and collects data for the resource.
startPeriod and endPeriod track the data range.Error Handling
Common Errors
| Status Code | Error | Solution |
|---|---|---|
400 | Invalid resource ID | Verify the resource ID is a valid MongoDB ObjectId |
404 | Resource not found | Check that the resource exists and hasn’t been deleted |
400 | Wrapper not found | Ensure the wrapper_id references an existing wrapper |
400 | Failed to create resource | Check request payload matches the schema |
Example Error Response
Best Practices
Use Auto-Creation
Let the system create resources automatically when generating wrappers to maintain consistency.
Descriptive Names
Use clear, descriptive names that indicate the indicator type and data source.
Monitor Wrappers
Regularly check wrapper health to ensure continuous data collection.
Handle Deletions Carefully
Remember that deleting a resource stops the wrapper permanently.
Next Steps
Generating Wrappers
Learn how to generate AI-powered wrappers for your resources
Monitoring
Monitor wrapper health and view execution logs
API Reference
View complete API documentation for resources
Wrapper Execution
Understand wrapper execution modes and lifecycle