Shift Assignments

Types

The GetListResult object

Field Type Description
HasMoreResults bool indicates if there are more results
Offset int Number of results skipped. Will match the parameter passed into the endpoint.
ResultCount int Number of results returned.
Data array of ShiftAssignment objects Shift assignments requested.

The ShiftAssignment object

Field Type Description
ShiftAssignmentId int unique id generated by NBS for the shift assignment
ScheduleId int unique id for the schedule
ScheduleName string Schedule name
ShiftId int unique id for the shift
ShiftName string Shift name
JobTitleId int
JobTitleName string
StartDateTime datetime Scheduled start of the assignment.
EndDateTime datetime Scheduled end of the assignment.
Type string Either “Shift Assignment” or “Ride Along”.
Assignee ShiftAssignmentAssignee object Employee or indvidual assigned to the assignment. null if the assignment is currently open.
VehicleName string object Vehicle assigned to the assignment. null if no vehicle is assigned.
ClockInDateTime datetime When the employee clocked into the shift assignment. Null if employee has not clocked in yet. Note that Ninth Brain has the concept of consecutive shifts so that an employee clock into multiple shifts at the same time. For example it is possible for an employee to clock in once at the start of two 12 hours shifts and then out 24 hours later.
ClockOutDateTime datetime When the employee clocked out of the shift assignment. Null if the employee has not clocked in yet or is currently clocked in.

The GetAssignmentChangesResult Object

Field Type Description
HasMoreResults bool indicates if there are more results
Offset int Number of results skipped. Will match the parameter passed into the endpoint.
ResultCount int Number of results returned.
Data array of AssignmentChange objects Shift assignment changes requested.

The AssignmentChange Object

Describes an event that happened to the shift assignment.

Field Type Description
EventType string Type of event that happened. Possible values: “Created”, “Assigned”, “Unassigned”, “Deleted”
EventTimeStamp datetime When the event occured.
ShiftAssignmentId int unique id generated by NBS for the shift assignment
ScheduleId int unique id for the schedule
ScheduleName string Schedule name
ShiftId int unique id for the shift
ShiftName string Shift name
JobTitleId int
JobTitleName string
StartDateTime datetime Scheduled start of the assignment.
EndDateTime datetime Scheduled end of the assignment.
Type string Either “Shift Assignment” or “Ride Along”.
Assignee ShiftAssignmentAssignee object Assignment related to the event. If EventType=“Assigned” it’s the new assignment. If EventType=“Unassigned” it’s the assignment removed.

The ShiftAssignmentAssignee object

Describes the assignee of the shift assignment. In most cases this is an employee of the company but ride alongs may be indviduals who are not employees of the company.

Field Type Description
NBSId int Unique identifier created by NBS. Will be null if the assignee is not an employee of the company. This only happens for “Ride Along” assignment types.
EmployeeNumber string Unique identfier set by the company. Will be null if the assignee is not an employee of the company. This only happens for “Ride Along” assignment types.
FirstName string Employee’s or indvidual’s first name.
LastName string Employee’s or indvidual’s last name.

Endpoints

Note on sending DateTimeOffset

Note that you can include the offset with the times but you need to html encode the + as %2B if you are sending one. For example you would send 2022-01-01T00:00+00:00 as 2022-01-01T00:00%2B00:00.

Get Shift Assignment List

Gets a list of assignments between two dates.

Authorization needed

Request
GET https://api.ninthbrain.com/ShiftAssignment/GetList?StartDate=2022-01-01T00:00%2B00:00&EndDate=2022-01-31T00:00%2B00:00&api-version=2.0

Query Parameters

Name Type Required Description
StartDate DateTimeOffset required Specifes date range of assignments to return. Filters based on assignment’s start date.

Note on sending offset with datetime
EndDate DateTimeOffset required Specifes date range of assignments to return. Filters based on assignment’s start date.

Note on sending offset with datetime
OnlyShiftAssignment bool optional Only return assignments that are shift assignments. Will cause ride alongs to not be returned. Defaults to false.
OnlyRideAlong bool optional Only return assignments that are ride alongs. Defaults to false.
OnlyOpenShifts bool optional Option to only return shifts that don’t have an employee assigned. Defaults to false.
OnlyFilledShifts bool optional Option to only return shifts that have an employee assigned. Defaults to false.
OnlyClockedInShifts bool optional Option to only return shifts that are currently clocked in. Defaults to false.
Offset int optional Used for paging results. Number of records to skip. Defaults to 0.
Limit int optional Used for paging results. Max number of results to return, must be between 1-200. Defaults to 200.
Example response
HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1342521939
{
	"HasMoreResults": false,
	"Offset": 0,
	"ResultCount": 1,
	"Data": [{
		"ShiftAssignmentId": 123123,
		"ScheduleId": 123,
		"ScheduleName": "Sample Schedule",
		"ShiftId": 123,
		"ShiftName": "Sample Shift",
		"JobTitleId": 123,
		"JobTitleName": "Sample Job Title",
		"StartDateTime": "2021-12-01T08:00:00-05:00",
		"EndDateTime": "2021-21-01T17:00:00-05:00",
		"Type": "Shift Assignment",
		"Assignee": {
			"NBSId": 123,
			"EmployeeNumber": "abc123",
			"FirstName": "John",
			"LastName": "Doe"
		},
		"VehicleName" : "Truck 123",
		"ClockInDateTime": "2021-12-01T08:00:00-05:00",
		"ClockOutDateTime": "2021-21-01T17:00:00-05:00"
	}]
}
Errors
  • bad_request (HTTP 400)
  • unauthorized (HTTP 401) - This APIKey is not valid for this service.
  • internal_error (HTTP 500)

Get Shift Assignment Changes

Gets a list of assignment changes between two dates. Events included: “Created”, “Assigned”, “Unassigned”, “Deleted”.

Authorization needed

Request
GET https://api.ninthbrain.com/ShiftAssignment/GetAssignmentChanges?StartDate=2022-01-01T08:00:00-05:00&EndDate=2022-01-02T00:00:00-05:00&api-version=2.0

Query Parameters

Name Type Required Description
StartDate DateTimeOffset required Specifes date range of assignment changes to return. Filters on the EventTimeStamp property.

Note on sending offset with datetime
EndDate DateTimeOffset required Specifes date range of assignment changes to return. Filters on the EventTimeStamp property.

Note on sending offset with datetime
Offset int optional Used for paging results. Number of records to skip. Defaults to 0.
Limit int optional Used for paging results. Max number of results to return, must be between 1-200. Defaults to 200.
Example response
HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1342521939
{
	"HasMoreResults": false,
	"Offset": 0,
	"ResultCount": 2,
	"Data": [{
			"EventType": "Created",
			"EventTimeStamp": "2021-12-01T08:05:00-05:00",
			"ShiftAssignmentId": 123123,
			"ScheduleId": 123,
			"ScheduleName": "Sample Schedule",
			"ShiftId": 123,
			"ShiftName": "Sample Shift",
			"JobTitleId": 123,
			"JobTitleName": "Sample Job Title",
			"StartDateTime": "2021-12-01T08:00:00-05:00",
			"EndDateTime": "2021-21-01T17:00:00-05:00",
			"Type": "Shift Assignment",
			"Assignee": {
				"NBSId": 123,
				"EmployeeNumber": "abc123",
				"FirstName": "John",
				"LastName": "Doe"
			}
		},
		{
			"EventType": "Assigned",
			"EventTimeStamp": "2021-12-01T08:05:30-05:00",
			"ShiftAssignmentId": 123124,
			"ScheduleId": 123,
			"ScheduleName": "Sample Schedule",
			"ShiftId": 123,
			"ShiftName": "Sample Shift",
			"JobTitleId": 123,
			"JobTitleName": "Sample Job Title",
			"StartDateTime": "2021-12-01T08:00:00-05:00",
			"EndDateTime": "2021-21-01T17:00:00-05:00",
			"Type": "Shift Assignment",
			"Assignee": {
				"NBSId": 1234,
				"EmployeeNumber": "abc1234",
				"FirstName": "Bill",
				"LastName": "Smith"
			}
		}
	]
}
Errors
  • bad_request (HTTP 400)
  • unauthorized (HTTP 401) - This APIKey is not valid for this service.
  • internal_error (HTTP 500)