who-working

Change the status of a shift

Update the status of a shift. Set a shift to OPEN or CLOSED. Before updating a shift, the user must locate an existing shift by the ID.

HTTP method

PATCH

URL

{server_url}/shifts/{id}

Request headers

Key Value
Content-Type application/json

Request body parameters

Property name Type Description
id number The unique ID assigned to the shift.
status string The shift is Open (waiting to fill the positon) or Closed (the positon is no longer available).

Example request body

{
        "status": "closed"
}
curl --location --request PATCH 'http://localhost:3000/shifts/df91' \
--header 'Content-Type: application/json' \
--data '{
    "status": "closed"
}'

Return body

    {
    "id": "df91",
    "date": "2024-07-21",
    "start_time": "0700",
    "shift_length": "6",
    "warning": "opening",
    "location_detail": "Eatons Centre",
    "status": "closed"
    }

Return status

Status value Return status Description
200 Success Requested data returned successfully
404 Error Specified user record not found
ECONNREFUSED N/A Service is offline. Start the service and try again.