Delete bag movements for an employee
This endpoint allows the deletion of bag movements associated with an employee within a specified time period.
DELETE /api/v1/businesses/{businessId}/bags/{bagId}/employees/{employeeId}/movements?from={yyyy-MM-dd}&to={yyyy-MM-dd}
If the data included in the request is correct, the response will be a 200 OK and all movements for that employee, for the specified bag, within the time period provided in the URL will be deleted.
Here is an example:
DELETE /api/v1/businesses/BUSINESSID/bags/DT/employees/1006357/movements?from=2024-09-22&to=2024-09-26
The response of this request will contain all the movements found and the status of each of them:
[
{
"status": "DELETE",
"employeeId": "1006357",
"destinationBagId": "DT",
"destinationDate": "2024-09-23",
"value": 1.0,
"reason": "Data adjustment 23"
},
{
"status": "DELETE",
"employeeId": "1006357",
"destinationBagId": "DT",
"destinationDate": "2024-09-24",
"value": 2.0,
"reason": "Data adjustment 24"
},
{
"status": "DELETE",
"employeeId": "1006357",
"destinationBagId": "DT",
"destinationDate": "2024-09-25",
"value": 1.0,
"reason": "Data adjustment 25"
}
]
In this example, the status field in each movement indicates whether it has been deleted: DELETE.
If any of the movements causes an error during deletion, the status field for that movement will show ERROR, and an additional cause field will indicate the reason for the error.
Considerations
The request removes all movements linked to the bag specified in the parameters: both movements where the bag is the origin and those where it is the destination.
Error codes
In addition to the common errors, this endpoint can return the following codes:
| Code | Message | Description |
|---|---|---|
|
Date range from to is not Valid |
The date specified in |
|
Bag for business not found |
The bag identifier does not match any bag in the business, or the employee identifier does not match any employee in the business: the same message covers both causes. It is recommended to verify the bag through Get business bags and the employee through Get employee information. |
Bag for person in business not found |
The bag and the employee exist, but that bag is not initialized for that employee, so it has no associated movements. |
|
Not Movements to Delete in Bag … for Employee … in Range from … to … |
There are no movements for that bag and that employee within the period specified in the URL. It is recommended to check the existing movements through Get bag movements by service. |
|
|
— |
At least one of the movements found could not be deleted. The response body is not an error message, but the same list of movements returned by the |
Useful links
What is a bag?