Error Handling
Understand the error responses from the Sistema de Gestión de Propiedades API and how to handle them gracefully in your application.Error Response Format
The API returns errors in JSON format with appropriate HTTP status codes:HTTP Status Codes
The API uses standard HTTP status codes:| Status Code | Meaning | Description |
|---|---|---|
| 200 OK | Success | Request completed successfully |
| 201 Created | Created | Resource created successfully |
| 400 Bad Request | Client Error | Invalid request data or validation failure |
| 401 Unauthorized | Auth Error | Missing or invalid authentication |
| 404 Not Found | Not Found | Resource doesn’t exist |
| 409 Conflict | Conflict | Resource already exists (duplicate ID) |
Common Errors
400 Bad Request
Returned when the request data is invalid or fails validation.Validation Errors
Invalid enum value
Invalid enum value
Error:Cause: Provided an invalid value for
estado or tipo_contratacionSolution:Missing required field
Missing required field
Error:Cause: Omitted a required field when creating a propertyRequired fields: pais, ciudad, direccion, ambientes, metros_cuadrados, precio, tipo_contratacion, estadoSolution:
Invalid codigo_id length
Invalid codigo_id length
Error:Cause: Provided a
codigo_id that’s not exactly 6 charactersSolution:Invalid data type
Invalid data type
Error:Cause: Sent a number field as a stringSolution:
Attempting to modify codigo_id
Attempting to modify codigo_id
Error:Cause: Tried to change the
codigo_id in a PATCH requestSolution:401 Unauthorized
Returned when authentication is missing or invalid. Error:- No
Authorizationheader provided - Invalid credentials
- Malformed Authorization header
404 Not Found
Returned when the requested resource doesn’t exist. Error:- Property ID doesn’t exist
- Property was deleted
- Typo in the ID
409 Conflict
Returned when creating a property with acodigo_id that already exists.
Error:
Error Handling Patterns
Basic Error Handler
Detailed Error Handler
Retry Logic
Python Error Handler
Validation Before Sending
Prevent errors by validating data client-side:Best Practices
Validate client-side first
Check data format and required fields before making API calls to reduce errors.
Next Steps
Validation Rules
Complete validation rules reference
Creating Properties
Learn about property creation
Authentication
Set up authentication correctly
API Reference
Browse the complete API reference