Skip to main content

GET Shift Assignments and Shift Changes

Retrieve shift assignments that have have been created or updated after a defined date.

Updated over 5 months ago

Enterprise level organisations may retrieve shift assignments scheduled in uTRAC using the following API endpoint.

Endpoint: YOUR_uTRAC_URL/api/shifts/staff/changes


Authentication

To access the above endpoint, you will need to include your unique X-APP-ID and X-API-KEY within the headers of your request.

Please contact your uTRAC account manager for details on how to enable authentication keys for your organisation.

Request Types

Each query to the endpoint must include 'from' and 'to' parameters to return shifts scheduled between a limited date range. You must also include a 'type' parameter to control what kind of information is returned (see query parameters below). Finally, there is the option to limit the returned assignments by their created date and last updated date.

Example Request

https://utrac.online/api/shifts/staff/changes?from=2023-12-01&to=2023-12-30&created_after=2023-09-01&updated_after=2023-11-01&type=CHANGED

Query Parameters

  • from: Shifts scheduled date is after this date. YYYY-MM-DD (Required)

  • to: Shifts scheduled date is before this date. YYYY-MM-DD (Required)

  • type: Controls the type of change that is returned. Returns new assignments with 'ASSIGNED'. Returns updated assignments with 'CHANGED'. Returns removed assignments with 'DELETED'. STRING (Required)

  • created_after: Shift assignment was created after OR equal to date. YYYY-MM-DD (Optional)

  • updated_after: Assignment record was updated after OR equal to date. Not available for Deleted shift records. YYYY-MM-DD (Optional)

Query Responses

200

Successful request.

400

Bad request. Please check your endpoint and/or parameters for correct implementation.

401

Unauthorized. Please check the API keys in the headers of your request.

500

Connection error. Please review your request and try again or contact support@utraconline.com.

Response Data

Shifts scheduled between the request's from and to dates with relevant assignment, changes or deleted data will be returned within a JSON array. The main body will include data related to each returned shift.

Main Body

    {
"project_id": 90531069,
"project_name": "Project Name",
"purchase_order_number": "PRO_1234",
"quote_number": "909",
"client_name": "Client Name",
"client_ref": "REF_123",
"client_postcode": "ABC 123",
"costcentre": "Live Events",
"shift_id": 9742569999,
"task_name": "General Operative",
"shift_start": "2023-12-23T08:00:50.000Z",
"shift_end": "2023-12-23T20:00:00.000Z",
...
},

Depending on the request type, the shift's related assignments, changes, and deleted assignments will be displayed as an object within the main body:

Assigned Query Types

    {
...
"assigned": [
{
"staff_name": "Adam Jones",
"payroll_number": "NUM_1234",
"assigned_at": "2023-11-23T20:52:48.000Z",
"assignment_id": "XXXX",
"assigned_by": "Manager Name",
"last_response": "2023-11-23T20:52:50.000Z"
}
]
},

Changed Query Types

   {
...
"changed": [
{
"staff_name": "Adam Jones",
"payroll_number": "NUM_1234",
"assigned_at": "2023-11-23T20:52:48.000Z",
"assignment_id": "XXXX",
"previous_status": "Unconfirmed",
"last_status": "Confirmed",
"actioned_on": "2023-11-23T20:52:50.000Z",
"actioned_by": "Manager Name"
}
]
},

Deleted Query Types

 {
...
"deleted": [
{
"staff_name": "Adam Jones",
"payroll_number": "NUM_1234",
"assigned_at": "2023-05-22T10:50:08",
"last_status": "Confirmed",
"deleted_reason": "Cancelled by Staff",
"deleted_by": "Manager Name",
"deleted_date": "2023-10-31T10:22:11.000Z"
}
]
},
Did this answer your question?