Restore a deleted cost centre
const url = 'https://api2.recruso.co.uk/v1/branches/1/cost-centres/1/restore';const options = { method: 'POST', headers: {Authorization: '<Authorization>', 'Content-Type': 'application/json'}, body: '{"branchId":4,"id":31}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api2.recruso.co.uk/v1/branches/1/cost-centres/1/restore \ --header 'Authorization: <Authorization>' \ --header 'Content-Type: application/json' \ --data '{ "branchId": 4, "id": 31 }'Reverses a soft delete, returning the cost centre to ListCostCentres and GetCostCentreById with its original name, Sage department and nominal code intact. There is no request body.
This is the resolution path for the 409 returned by CreateCostCentre and UpdateCostCentre: take the costCentreId from that response and call this endpoint with it.
If an active cost centre has since taken the same name in the branch, the restore returns 400 — rename or delete that one first. A cost centre that is not deleted, does not exist, is under a different branch, or is under a branch you cannot access returns 404.
Access. Requires a client-credentials access token. Tokens issued through the interactive user login are rejected.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The branchId path parameter
The id path parameter
Request Bodyrequired
Section titled “Request Bodyrequired”Identifies the deleted cost centre to restore. Both values are bound from the route; the endpoint takes no request body.
object
The branch the deleted cost centre belongs to.
Example
4The deleted cost centre to restore. This is the costCentreId returned in the 409 body of CreateCostCentre or UpdateCostCentre.
Example
31Responses
Section titled “Responses”OK
The restored cost centre, active again with the values it held when it was deleted.
object
The cost centre’s identifier. The original id is kept, not reallocated.
The branch the cost centre belongs to.
The cost centre name, as it was before the delete.
The cost centre’s Sage department. The parent branch carries a sageDepartmentId of its own; which one a posting uses is decided by the Sage integration, not by this endpoint.
The nominal (general-ledger) code this cost centre posts against.
Example
{ "costCentreId": 31, "branchId": 4, "costCentreName": "Warehouse Operatives", "sageDepartmentId": 21, "nominalCode": 4001}Bad Request
object
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example"}Unauthorized
object
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example"}Forbidden
object
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example"}Not Found
object
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example"}
