Sorting¶
Some API endpoints support sorting results based on specific fields. This is useful when you want to display data in a particular order (e.g., most recent first, alphabetical, etc.).
How to Use¶
To sort results, use the sort query parameter:
sort=fieldfor ascending ordersort=-fieldfor descending order
You can sort by any of the following supported fields:
| Field | Description |
|---|---|
| title | Sort positions by title |
| job_start | Sort by job start date |
| job_end | Sort by job end date |
| created_at | Sort by creation date |
Examples¶
Sort by created_at (newest first)¶
curl -s -X GET "http://127.0.0.1:8000/api/public/inquiry/1/positions?sort=-created_at" \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json" | jq
Sort by job_start (ascending)¶
curl -s -X GET "http://127.0.0.1:8000/api/public/inquiry/1/positions?sort=-job_start" \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json" | jq
Sort by title (A - Z)¶
curl -s -X GET "http://127.0.0.1:8000/api/public/inquiry/1/positions?sort=title" \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json" | jq
Example Responses (sample shapes)¶
Positions¶
{
"current_page": 1,
"data": [ /* array of position objects */ ],
"per_page": 5,
"total": 12,
"last_page": 3
}
Inquiries¶
{
"total": 7,
"per_page": 10,
"current_page": 1,
"last_page": 1,
"from": 1,
"to": 7,
"orders": [ /* array of inquiry summary objects */ ]
}