Overview
The Project Resources API allows you to manage the assignment, tracking, and release of equipment and services for projects. You can add resources to projects, update their configuration, release them when no longer needed, and query available resources.Endpoints
Get Available Resources
Retrieve a list of all available equipment and resources that can be assigned to projects.Query Parameters
Filter by equipment type (e.g., BTSNHM, LVMNOS, SERVIC)
Filter by equipment status (e.g., FUNCIONANDO, DAÑADO)
Search by equipment code or name
Exclude service-type resources from results
Response
Indicates if the request was successful
Total number of available resources
Array of available resource objects
Example Request
Example Response
Add Resource to Project
Assign one or more resources to a project with cost and scheduling information.Request Body
The request body should be an array of resource objects to add:ID of the project to assign resources to
ID of the resource item to assign
Rental or service cost
Maintenance cost (creates a separate maintenance service entry)
Frequency type for scheduling:
DAY, WEEK, or MONTHNumber of days between occurrences (used when frequency_type is DAY)
Days of the week (0=Monday, 6=Sunday). Used when frequency_type is WEEK
Days of the month (1-31). Used when frequency_type is MONTH
Start date for resource operation (YYYY-MM-DD)
End date for resource operation (YYYY-MM-DD)
ID of physical equipment this service is associated with
Detailed description of the resource assignment
Date when equipment is committed to the project
Response
Array of created project resource assignments
Example Request
Example Response
Automatic Status Updates: When equipment is added to a project:
stst_status_disponibilitychanges toRENTADOstst_current_locationupdates to project locationstst_current_project_idset to the project IDstst_commitment_dateset to operation start date
Update Resource Item
Update the cost, frequency, or dates for a resource assigned to a project.Request Body
ID of the ProjectResourceItem to update
Updated rental or service cost
Frequency type:
DAY, WEEK, or MONTHNumber of days between occurrences (for DAY frequency)
Days of the week (0=Monday, 6=Sunday) for WEEK frequency
Days of the month (1-31) for MONTH frequency
Updated detailed description
Updated start date (YYYY-MM-DD)
Updated end date (YYYY-MM-DD)
Updated maintenance cost (updates linked service if it exists)
Set to true to retire the resource
Date of retirement (required if is_retired is true)
Reason for retirement (required if is_retired is true)
Response
Success message
Updated project resource object with all fields
Example Request
Example Response
Linked Service Updates: When updating maintenance_cost for equipment, any linked maintenance service will automatically have its cost and frequency synchronized.
Delete Resource from Project
Permanently remove a resource assignment from a project.Path Parameters
ID of the ProjectResourceItem to delete
Response
Returns HTTP 204 No Content on success.Error Responses
Error message if deletion fails
Example Request
Resource Liberation: When a resource is deleted:
- Physical equipment status changes back to
DISPONIBLE stst_current_project_idis cleared- The ProjectResourceItem record is permanently deleted
Release Resource from Project
Release (retire) a resource from a project without permanently deleting it.Request Body
ID of the ProjectResourceItem to release
Response
Success message
Released project resource object
IDs of related services that were also released (equipment only)
Number of related services released (equipment only)
Example Request
Example Response (Equipment)
Example Response (Service)
Difference from Delete: Release marks resources as retired (
is_retired=true) and preserves the historical record, while Delete permanently removes the assignment.Automatic Service Release: When equipment is released, all associated maintenance and services are automatically retired as well.
Get Project Resources
Retrieve all resources assigned to a specific project.Path Parameters
ID of the project
Response
Array of project resource objects
Example Request
Example Response
Error Codes
The Project Resources API uses standard HTTP status codes:Request successful
Resource successfully created
Resource successfully deleted
Invalid request parameters or validation error
- Missing required fields
- Invalid date format
- Resource already rented
- Resource used in custody chain (cannot delete)
- Invalid frequency configuration
- Project not found or inactive
- Resource not found or inactive
- ProjectResourceItem not found
Unexpected server error (check logs)
Validation Rules
Adding Resources
project_id,resource_id,cost, andoperation_start_dateare required- Resource must have
status_disponibilityofDISPONIBLE(notRENTADO) - Dates must be in
YYYY-MM-DDformat operation_end_datecannot be earlier thanoperation_start_date- For
frequency_type="DAY":interval_daysmust be ≥ 1 - For
frequency_type="WEEK":weekdaysarray must have at least one value (0-6) - For
frequency_type="MONTH":monthdaysarray must have at least one value (1-31)
Updating Resources
- Cannot update retired resources (
is_retired=True) - Cannot update resources in inactive projects
- Frequency type changes must include appropriate interval/weekdays/monthdays
Deleting Resources
- Cannot delete resources used in custody chains
- Resource must exist and belong to an active project
Releasing Resources
- Cannot release already retired resources
- When releasing equipment, all linked services are automatically retired
Data Model: ProjectResourceItem
TheProjectResourceItem model represents the assignment of a resource to a project:
| Field | Type | Description |
|---|---|---|
id | Integer | Primary key |
project | ForeignKey | Reference to Project |
resource_item | ForeignKey | Reference to ResourceItem |
type_resource | String | EQUIPO or SERVICIO |
detailed_description | String | Formatted description |
physical_equipment_code | Integer | Physical equipment ID (for services) |
cost | Decimal | Cost per period |
frequency_type | String | DAY, WEEK, or MONTH |
interval_days | Integer | Days between occurrences |
weekdays | JSON | Array of weekday numbers |
monthdays | JSON | Array of month day numbers |
operation_start_date | Date | Start of operation |
operation_end_date | Date | End of operation |
is_retired | Boolean | Retirement status |
retirement_date | Date | Date of retirement |
retirement_reason | Text | Reason for retirement |
is_active | Boolean | Active flag |
is_deleted | Boolean | Soft delete flag |
Get Complete Project Information
Retrieve comprehensive information about a project including all work orders, custody chains, sheet details, and metadata.ID of the project to retrieve complete information for
Response
Returns a detailed object containing:Indicates if the request was successful
Complete project information object
Total custody chains across all work orders
Example Response
This endpoint is useful for generating comprehensive project reports, dashboards, and export functionality. It includes complete nested data structures with metadata for audit purposes.
Best Practices
Use Batch Creation
When adding multiple resources to a project, include them all in a single POST request array for better performance.
Release Instead of Delete
Use the release endpoint to retire resources instead of deleting them to preserve historical records and audit trails.
Check Availability First
Before assigning resources, query the available resources endpoint to ensure equipment is not already in use.
Sync Maintenance Services
When updating equipment frequency or dates, related maintenance services are automatically synchronized.
Handle Date Ranges Carefully
Ensure operation dates fall within the project’s start and end dates for proper scheduling.