Link a cost centre to a site contact
const url = 'https://api2.recruso.co.uk/v1/clients/1/sites/1/contact-persons/1/cost-centres';const options = { method: 'POST', headers: {Authorization: '<Authorization>', 'Content-Type': 'application/json'}, body: '{"costCentreId":19}'};
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/clients/1/sites/1/contact-persons/1/cost-centres \ --header 'Authorization: <Authorization>' \ --header 'Content-Type: application/json' \ --data '{ "costCentreId": 19 }'Links one of your agency’s cost centres to a contact at a site, narrowing which cost centres that person’s work is booked against. This is the contact-level counterpart to AddSiteCostCentre.
The cost centre must belong to the same branch as the site, exactly as for a site link: a cross-branch link returns 400, and a site with no branch assigned cannot be linked at all.
A cost centre already linked to the contact returns 400 rather than creating a duplicate, and a cost centre that does not exist returns 400.
The client, site and contact in the route must line up — the site must belong to the client and the contact to the site — and any mismatch returns 404 rather than 403.
On success the Location header points at ListSiteContactCostCentres, since a single link has no endpoint of its own.
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 clientId path parameter
The siteId path parameter
The contactPersonId path parameter
Request Bodyrequired
Section titled “Request Bodyrequired”The cost centre to link to the site contact.
object
The cost centre being linked. Must belong to the same branch as the site.
Example
19Responses
Section titled “Responses”Created
A newly created site contact cost centre link.
object
The link’s own identifier. This is what RemoveSiteContactCostCentre takes, not the cost centre id.
The site contact the cost centre is linked to.
The cost centre being linked. Must belong to the same branch as the site.
Example
{ "contactPersonCostCentreId": 204, "contactPersonId": 88, "costCentreId": 19}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"}
