Set a worker's profile image
const url = 'https://api2.recruso.co.uk/v1/workers/1/image';const form = new FormData();form.append('workerId', '4821');form.append('file', 'file');
const options = {method: 'PUT', headers: {Authorization: '<Authorization>'}};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api2.recruso.co.uk/v1/workers/1/image \ --header 'Authorization: <Authorization>' \ --header 'Content-Type: multipart/form-data' \ --form workerId=4821 \ --form file=@fileSets the profile photograph for a worker in your own agency, sent as multipart/form-data with the image in a part named file.
Accepted types are jpg, jpeg, png, gif, up to 3 MB. Anything else returns 400.
A worker has at most one profile image, so this replaces whatever is there rather than adding to it, and the image it replaces is deleted from storage. The record keeps no history and no audit of who changed it, so the previous image cannot be recovered.
Returns 204 with no body. Read the image back through GET on the same route.
A worker id belonging to another agency returns 404 rather than 403, so their existence is never disclosed.
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 workerId path parameter
Request Bodyrequired
Section titled “Request Bodyrequired”The photograph to set as a worker’s profile image, sent as multipart/form-data.
object
The worker the image belongs to. Taken from the route.
Example
4821The image itself. Its name is not kept — a worker has only one profile image, so there is nothing to tell one upload from another by.
Responses
Section titled “Responses”No Content
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"}
