PCH-SIG API Reference
The PCH-SIG API is a REST API that allows interaction with all system features.
Base URL
https://sig.ucp-pch.org/api
Authentication
The API uses JSON Web Tokens (JWT) for authentication.
Obtain a Token
curl -X POST https://sig.ucp-pch.org/api/login \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "password": "password"}'
Response:
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...",
"refresh_token": "abc123...",
"user": {
"id": 1,
"email": "user@example.com",
"roles": ["ROLE_USER", "ROLE_ADMIN"]
}
}
Using the Token
Include the token in the Authorization header:
curl https://sig.ucp-pch.org/api/menages \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9..."
HTTP Status Codes
| Code | Description |
|---|---|
200 | Success |
201 | Resource created |
204 | Success with no content (DELETE) |
400 | Invalid request |
401 | Not authenticated |
403 | Access denied |
404 | Resource not found |
422 | Validation error |
500 | Server error |
Pagination
Collections are paginated by default (30 items per page).
Parameters
| Parameter | Description | Example |
|---|---|---|
page | Page number | ?page=2 |
itemsPerPage | Items per page | ?itemsPerPage=50 |
Main Endpoints
Authentication
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/login | Login |
| POST | /api/token/refresh | Refresh token |
| POST | /api/logout | Logout |
Households
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/menages | List of households |
| GET | /api/menages/\{id\} | Household detail |
| POST | /api/menages | Create a household |
| PUT | /api/menages/\{id\} | Modify a household |
| DELETE | /api/menages/\{id\} | Delete a household |
Beneficiaries
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/beneficiaires | List of beneficiaries |
| GET | /api/beneficiaires/\{id\} | Beneficiary detail |
Payment Cycles
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/cycles | List of cycles |
| POST | /api/cycles | Create a cycle |
| POST | /api/cycles/\{id\}/generate | Generate payments |
| POST | /api/cycles/\{id\}/validate | Validate the cycle |