Tutorial: Cancel a Position in an Inquiry¶
This tutorial walks you through the workflow for canceling an existing position (hire) from a given inquiry using the public API layer in People Cloud.
This public endpoint is routed through the same internal validation and business logic used by the main People Cloud platform, ensuring consistency across environments.
Step 1: Make a POST Request to Cancel a Position¶
Send a POST request to the following endpoint to cancel an existing position:
POST /api/public/inquiry/{orderId}/position/{positionId}/cancel
Authorization¶
This endpoint requires authentication. Use the Bearer token from the authenticated user session.
Request Headers¶
Authorization: Bearer <your_token_here>
Accept: application/json
Content-Type: application/json
Request Body¶
No body is required for this cancel request. It is a simple action trigger.
Step 2: Cancel the Position¶
You can use the following curl command to cancel a position:
curl -X POST http://127.0.0.1:8000/api/public/inquiry/1/position/21/cancel \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json"
This command cancels the position with ID 21 from inquiry 1.
Step 3: Evaluate Response¶
If the cancellation is successful, you will receive a response like this:
{
"message": "Position successfully canceled"
}
Step 4: Error Handling¶
| Status | Meaning | Description |
|---|---|---|
| 200 | OK | Position was canceled successfully. |
| 401 | Unauthorized | Missing or invalid Bearer token. |
| 403 | Forbidden | You don’t have permission to cancel this item. |
| 404 | Not Found | Either the inquiry or position was not found. |
| 409 | Conflict | Position cannot be canceled due to its current state. |
| 422 | Validation | Invalid input or state for canceling the position. |