Scheduling Audit Rest Api

Note: This page has not yet been converted to the new developer portal format. Please use Swagger to test this API.

Scheduling Audit REST API

SchedulingAudit is a
read-only resource, meaning audits cannot be modified or deleted. Hence, there is only one API to get
the audits. However, the result can be filtered in various ways as per the need.

GET /scheduling/{organizationId}/audits

Description

Gets all the audits for the given Organization ID (default sorted descending by the
createdDate; that is, latest audits at the top).

URL

/scheduling/{organizationId}/audits

Method

GET

URL Parameters

ParametersRequired?Data Type?Description

organizationId

y

Long

The ID of the Organization.

Request Parameters

ParametersRequired?Data Type?Description

fields

N

String

Any SchedulingAudit field
Ex: calendarId, action

filter

N

String

Any non transient SchedulingAudit field
Ex: filter[calendarId]=1234567890, filter[action]=CREATE, filter[auditResource.type]=calendar , and so forth.
Alternatively, filter can also be applied by directly using the field name such as:
Filter by one or more calendar IDs: calendarId={value_1}&calendarId={value_2}&...

Filter by action: action={value}
Possible values: CREATE, UPDATE, DELETE

Filter by date range: createdDate[gte]={start_date}&createdDate[lte]={end_date}
Possible values: yyyy-MM-dd or yyyy-MM-dd'T'HH:mm:ss'Z',
Ex: 2019-01-09 or 2019-01-09T00:00:00Z

NOTE: This approach does not work for nested properties. For example, auditResource.type=calendar will not work; it must be filter[auditResource.type]=calendar.

sort

N

String

Any non transient SchedulingAudit field
Ex: action, calendarId, createdDate
Default sort: -createdDate (sorted by createdDate descending, i.e. latest audits at the top)

pageSize

N

Integer

Default pageSize: 20

pageNo

No

Integer

Default pageNo: 1

NOTE: includes request parameter is not supported/required for the Audit, as every Audit record is self-contained with the information to be included with the values available at the time of the audit.

Responses

CodeResponse

200

◊ Audits for the given Organization ID
{
"currentPageNo": 1,
"totalPageCount": 1,
"totalCount": 6,
"pageSize": 20,
"data": [
{
"id": 884011643699301,
"type": "audit",
"accountId": 8800387990610,
"action": "DELETE",
"auditResource": {
"id": "884011643707737",
"type": "staffSchedule",
"minStaff": 0,
"name": "Layer A",
"recurrence": {
"type": "periodic",
"datesApplicable": {
"from": "2019-02-05",
"to": "2020-02-04"
},
"everyNRecurrence": 1
},
"staffAssignments": [
{
"type": "mixed",
"days": [
1,
2,
3,
4,
5,
6,
7
],

"ids": [
{
"id": 906001878874392,
"type": "contact"
},
{
"id": 906001878874393,
"type": "contact"
}
]
}
],
"staffEachDay": false,
"staffRotation": {
"type": "rotateOnSchedule",
"numberOfStaffOnCall": 2,
"numberOfStaffToRotate": 1,
"rotationDirection": "firstToLast"
}
},
"calendarId": 884011643719671,
"createdDate": "2019-02-04T16:03:47Z",
"createdId": 444206992589663,
"createdName": "Nick Leo",
"includes": [
{
"id": 884011643709001,
"name": "P1 Shift renewed",
"timeZoneString": "Asia/Shanghai",
"type": "shiftSchedule"
},
{
"id": 884011643719671,
"name": "Audit Calendar",
"type": "calendar"
},
{
"id": 906001878874392,
"firstName": "A",
"lastName": "A",
"middleInitial": null,
"suffix": null,
"type": "contact"
},

{
"id": 906001878874393,
"firstName": "B",
"lastName": "B",
"middleInitial": null,
"suffix": null,
"type": "contact"
}
],
"organizationId": 1328214341321061,
"resourceBundleId": 1328214341321134,
"shiftScheduleId": 884011643709001,
"staffScheduleId": 884011643707737
},
{
"id": 884011643699300,
"type": "audit",
"accountId": 8800387990610,
"action": "UPDATE",
"auditResource": {
"id": "884011643709001",
"type": "shiftSchedule",
"datesApplicable": {
"from": "2019-02-04",
"to": "2020-02-04"
},
"name": "P1 Shift renewed",
"numDays": 7,
"override": false,
"schedule": [
{
"type": "day",
"days": [
1,
2,
3,
4,
5,
6,
7
],

"shift": {
"end": "06:00",
"start": "00:00"
}
}
],
"sequenced": false,
"timeZoneString": "Asia/Shanghai",
"weekStartsWith": "SUNDAY"
},
"calendarId": 884011643719671,
"createdDate": "2019-02-04T16:03:47Z",
"createdId": 444206992589663,
"createdName": "Nick Leo",
"details": {
"groupId": {
"before": 906001876271900,
"after": 0
},
"schedules": {
"before": [
{
"shift": {
"end": "00:00",
"start": "00:00"
},
"days": [
1,
2,
3,
4,
5,
6,
7
]
}
],
"after": [
{
"shift": {
"end": "06:00",
"start": "00:00"
},

"days": [
1,
2,
3,
4,
5,
6,
7
]
}
]
},
"name": {
"before": "P1 Shift",
"after": "P1 Shift renewed"
},
"sequenced": {
"before": true,
"after": false
}
},
"includes": [
{
"id": 906001876271900,
"name": "Group A",
"type": "group"
},
{
"id": 884011643719671,
"name": "Audit Calendar",
"type": "calendar"
}
],
"organizationId": 1328214341321061,
"resourceBundleId": 1328214341321134,
"shiftScheduleId": 884011643709001
},
{
"id": 884011643699299,
"type": "audit",
"accountId": 8800387990610,
"action": "CREATE",
"auditResource": {
"id": "884011643700981",
"type": "staffSubstitution",

"contactId": 906001878874392,
"recurrence": {
"type": "ical",
"datesApplicable": {
"from": "2019-02-03",
"to": "2019-02-28"
},
"event": {
"end": "2019-02-04T00:00:00",
"start": "2019-02-03T00:00:00"
},
"rrule": "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO;UNTIL=20190227T160000Z"
},
"timeZoneString": "Asia/Shanghai"
},
"calendarId": 884011643719068,
"createdDate": "2019-02-04T16:02:02Z",
"createdId": 444206992589663,
"createdName": "Nick Leo",
"includes": [
{
"id": 906001878874392,
"firstName": "A",
"lastName": "A",
"middleInitial": null,
"suffix": null,
"type": "contact"
},
{
"id": 884011643719068,
"name": "bbb",
"type": "calendar"
}
],
"organizationId": 1328214341321061,
"resourceBundleId": 1328214341321134,
"staffSubstitutionId": 884011643700981
},
{
"id": 884011643699298,
"type": "audit",
"accountId": 8800387990610,
"action": "CREATE",

"auditResource": {
"id": "884011643707737",
"type": "staffSchedule",
"minStaff": 0,
"name": "Layer A",
"recurrence": {
"type": "periodic",
"datesApplicable": {
"from": "2019-02-05",
"to": "2020-02-04"
},
"everyNRecurrence": 1
},
"staffAssignments": [
{
"type": "mixed",
"days": [
1,
2,
3,
4,
5,
6,
7
],
"ids": [
{
"id": 906001878874392,
"type": "contact"
},
{
"id": 906001878874393,
"type": "contact"
}
]
}
],
"staffEachDay": false,
"staffRotation": {
"type": "rotateOnSchedule",
"numberOfStaffOnCall": 2,
"numberOfStaffToRotate": 1,
"rotationDirection": "firstToLast"
}

},
"calendarId": 884011643719671,
"createdDate": "2019-02-04T16:01:08Z",
"createdId": 444206992589663,
"createdName": "Nick Leo",
"includes": [
{
"id": 884011643709001,
"name": "P1 Shift",
"timeZoneString": "Asia/Shanghai",
"type": "shiftSchedule"
},
{
"id": 884011643719671,
"name": "Audit Calendar",
"type": "calendar"
},
{
"id": 906001878874392,
"firstName": "A",
"lastName": "A",
"middleInitial": null,
"suffix": null,
"type": "contact"
},
{
"id": 906001878874393,
"firstName": "B",
"lastName": "B",
"middleInitial": null,
"suffix": null,
"type": "contact"
}
],
"organizationId": 1328214341321061,
"resourceBundleId": 1328214341321134,
"shiftScheduleId": 884011643709001,
"staffScheduleId": 884011643707737
},

{
"id": 884011643699297,
"type": "audit",
"accountId": 8800387990610,
"action": "CREATE",
"auditResource": {
"id": "884011643709001",
"type": "shiftSchedule",
"datesApplicable": {
"from": "2019-02-04",
"to": "2020-02-04"
},
"groupId": 906001876271900,
"name": "P1 Shift",
"numDays": 7,
"override": false,
"schedule": [
{
"type": "day",
"days": [
1,
2,
3,
4,
5,
6,
7
],
"shift": {
"end": "00:00",
"start": "00:00"
}
}
],
"sequenced": true,
"timeZoneString": "Asia/Shanghai",
"weekStartsWith": "SUNDAY"
},
"calendarId": 884011643719671,
"createdDate": "2019-02-04T15:59:48Z",
"createdId": 444206992589663,
"createdName": "Nick Leo",
"includes": [
{

"id": 884011643719671,
"name": "Audit Calendar",
"type": "calendar"
}
],
"organizationId": 1328214341321061,
"resourceBundleId": 1328214341321134,
"shiftScheduleId": 884011643709001
},
{
"id": 884011643699296,
"type": "audit",
"accountId": 8800387990610,
"action": "CREATE",
"auditResource": {
"id": "884011643719671",
"type": "calendar",
"active": false,
"description": "This calendar is to test audit changes!",
"emailNotificationEnabled": true,
"emailNotificationList": [
"[email protected]"
],
"holidayCalendarCodes": [
"IN",
"GB"
],
"name": "Audit Calendar",
"notifyScheduled": false,
"visibility": "contact"
},
"calendarId": 884011643719671,
"createdDate": "2019-02-04T15:58:37Z",
"createdId": 444206992589663,
"createdName": "Nick Leo",
"includes": [
{
"id": "IN",
"name": "India",
"type": "availableHolidayCalendar"
},

{
"id": "GB",
"name": "United Kingdom",
"type": "availableHolidayCalendar"
}
],
"organizationId": 1328214341321061,
"resourceBundleId": 1328214341321134
}
]
}

◊ No audits available for the given Organization ID
{
"currentPageNo": 1,
"totalPageCount": 0,
"totalCount": 0,
"pageSize": 20,
"data": []
}

401

◊ Invalid JWT access token
{
"status": 401,
"message": "Invalid credentials: Invalid or missing Authorization header"
}
◊ No organization access to the user
{
"status": 401,
"message": "Org 1234567890 not accessible to this user, or does not exist."
}