Shift Information APIs (Service Board)
Use these APIs to retrieve shift segment information for resources and crews within a specified date range. You can invoke these APIs with Groovy or via a REST call.
Groovy API
Max.svmx_shift_information_manager(Map<String, Object> params)
Retrieves all durations within the specified date-time range for input resources. The time zone from the related shift plan is applied to create shift segments by day as needed.
Parameters
Parameter Name
Parameter Type
Validation
Description
resources
String
Required, comma-separated
Comma-separated list of resource IDs. Salesforce and Service Board UUIDs are supported.
* 
This value cannot be left empty, and a maximum of 100 resources can be specified.
startDate
String
Required, UTC format
Start date and time of the query range.
* 
This value cannot be left empty.
endDate
String
Required, UTC format
End date and time of the query range.
* 
This value cannot be left empty, and the maximum date range is 12 months.
isDaily
boolean
Optional, defaults to false
Specifies whether to truncate returned shift information based on working hours for the relevant day or preserve shift segment definition values.
isExternalID
boolean
Optional, defaults to false
Specifies whether to use external resource IDs. If set to true, Salesforce IDs are output in returned data.
truncateStartEnd
boolean
Optional, defaults to true
Defines whether to truncate first and last shift segment durations with specified start and end dates and times.
ignoreNoConfigSegment
boolean
Optional, defaults to false
Specifies whether to ignore segment durations with a type of _No_Config.
Response
The response is a JSON String of shift information in UTC format.
Response Detail
Possible Value
Notes
success
true or false
Indicates whether requests were processed successfully.
error
Error message with details
Details include validation errors and unexpected internal errors.
data
List of duration values
Nodes have the following attributes:
id: Shift Exception record IDs. Optional, and available only when current duration values originate from shift exception records.
resourceId: Salesforce IDs or UUIDs for technicians.
startDate: Start date and time for the duration.
endDate: End date and time for the duration.
type: Shift segment type. Includes No_Config when no durations are configured, and Holiday for holiday durations.
isAvailable: Whether the current duration is available.
If ignoreNoConfigSegment is left unspecified or set to false, all durations are returned, not just configured shift-related durations. For example, a shift configured as 0900 to 1700 returns [0 ~ 9, 9 ~ 17, 17 ~ 0] (the 0000 to 0900 and 0900 to 1700 durations):
{
"success": true,
"data": [
{
"resourceId": "ddeb094d-426c-4e31-9bd3-a4934d69c6de",
"startDate": "2020-03-30T00:00:00.000Z",
"endDate": "2020-03-30T09:00:00.000Z",
"type": "_No_Config",
"isAvailable": false
},
{
"resourceId": "ddeb094d-426c-4e31-9bd3-a4934d69c6de",
"startDate": "2020-03-30T09:00:00.000Z",
"endDate": "2020-03-30T17:00:00.000Z",
"type": "Work",
"isAvailable": true
},
{
"resourceId": "ddeb094d-426c-4e31-9bd3-a4934d69c6de",
"startDate": "2020-03-30T17:00:00.000Z",
"endDate": "2020-03-31T00:00:00.000Z",
"type": "_No_Config",
"isAvailable": false
}
]
}
* 
If ignoreNoConfigSegment is set to true, only the 0900 to 1700 duration is returned.
Shift Information REST API
POST/shiftInformation
Parameters
For the request body, send a JSON-formatted String with the same set of parameters as for the Groovy API.
Response
The response is a JSON String of shift information in UTC format.
For more information on how to invoke the REST API from Service Board, see Calling Protected Resources From Outside the Max Platform.
Example
// Call Shift Information API in groovy:

def params = [:]
params.with {
resources = 'f5e41031-fde7-4278-a7b3-320b33ab99c1'
startDate = '2020-03-23T00:00:00.000Z'
endDate = '2020-03-24T00:00:00.000Z'
isDaily = false
truncateStartEnd = false
}
def shiftInfo = Max.svmx_shift_information_manager(params) // Call the shift information operation from groovy
REST API Input and Output Samples
Typical Week Shift Input
{
"resources": "50f15de5-47fc-44d6-9b3c-66cc10522841",
"startDate": "2020-04-01T00:00:00.000Z",
"endDate": "2020-04-03T00:00:00.000Z"
}
Typical Week Shift Output
{
"success": true,
"data": [
{
"resourceId": "50f15de5-47fc-44d6-9b3c-66cc10522841",
"startDate": "2020-04-01T00:00:00.000Z",
"endDate": "2020-04-01T09:00:00.000Z",
"type": "_No_Config",
"isAvailable": false
},
{
"resourceId": "50f15de5-47fc-44d6-9b3c-66cc10522841",
"startDate": "2020-04-01T09:00:00.000Z",
"endDate": "2020-04-01T17:00:00.000Z",
"type": "Work",
"isAvailable": true
},
{
"resourceId": "50f15de5-47fc-44d6-9b3c-66cc10522841",
"startDate": "2020-04-01T17:00:00.000Z",
"endDate": "2020-04-02T09:00:00.000Z",
"type": "_No_Config",
"isAvailable": false
},
{
"resourceId": "50f15de5-47fc-44d6-9b3c-66cc10522841",
"startDate": "2020-04-02T09:00:00.000Z",
"endDate": "2020-04-02T17:00:00.000Z",
"type": "Work",
"isAvailable": true
},
{
"resourceId": "50f15de5-47fc-44d6-9b3c-66cc10522841",
"startDate": "2020-04-02T17:00:00.000Z",
"endDate": "2020-04-03T00:00:00.000Z",
"type": "_No_Config",
"isAvailable": false
}
]
}
Typical Week Shift With External ID Input
{
"resources": "a1a4P00000EqeflQAB",
"startDate": "2020-04-01T00:00:00.000Z",
"endDate": "2020-04-03T00:00:00.000Z",
"isExternalID": true
}
Typical Week Shift With External ID Output
{
"success": true,
"data": [
{
"resourceId": "a1a4P00000EqeflQAB",
"startDate": "2020-04-01T00:00:00.000Z",
"endDate": "2020-04-01T09:00:00.000Z",
"type": "_No_Config",
"isAvailable": false
},
{
"resourceId": "a1a4P00000EqeflQAB",
"startDate": "2020-04-01T09:00:00.000Z",
"endDate": "2020-04-01T17:00:00.000Z",
"type": "Work",
"isAvailable": true
},
{
"resourceId": "a1a4P00000EqeflQAB",
"startDate": "2020-04-01T17:00:00.000Z",
"endDate": "2020-04-02T09:00:00.000Z",
"type": "_No_Config",
"isAvailable": false
},
{
"resourceId": "a1a4P00000EqeflQAB",
"startDate": "2020-04-02T09:00:00.000Z",
"endDate": "2020-04-02T17:00:00.000Z",
"type": "Work",
"isAvailable": true
},
{
"resourceId": "a1a4P00000EqeflQAB",
"startDate": "2020-04-02T17:00:00.000Z",
"endDate": "2020-04-03T00:00:00.000Z",
"type": "_No_Config",
"isAvailable": false
}
]
}
Typical Week Shift Truncated by Day Input
{
"resources": "a1a4P00000EqeflQAB",
"startDate": "2020-04-01T00:00:00.000Z",
"endDate": "2020-04-03T00:00:00.000Z",
"isDaily": true,
"isExternalID": true
}
Typical Week Shift Truncated by Day Output
{
"success": true,
"data": [
{
"resourceId": "a1a4P00000EqeflQAB",
"startDate": "2020-04-01T00:00:00.000Z",
"endDate": "2020-04-01T09:00:00.000Z",
"type": "_No_Config",
"isAvailable": false
},
{
"resourceId": "a1a4P00000EqeflQAB",
"startDate": "2020-04-01T09:00:00.000Z",
"endDate": "2020-04-01T17:00:00.000Z",
"type": "Work",
"isAvailable": true
},
{
"resourceId": "a1a4P00000EqeflQAB",
"startDate": "2020-04-01T17:00:00.000Z",
"endDate": "2020-04-02T00:00:00.000Z",
"type": "_No_Config",
"isAvailable": false
},
{
"resourceId": "a1a4P00000EqeflQAB",
"startDate": "2020-04-02T00:00:00.000Z",
"endDate": "2020-04-02T09:00:00.000Z",
"type": "_No_Config",
"isAvailable": false
},
{
"resourceId": "a1a4P00000EqeflQAB",
"startDate": "2020-04-02T09:00:00.000Z",
"endDate": "2020-04-02T17:00:00.000Z",
"type": "Work",
"isAvailable": true
},
{
"resourceId": "a1a4P00000EqeflQAB",
"startDate": "2020-04-02T17:00:00.000Z",
"endDate": "2020-04-03T00:00:00.000Z",
"type": "_No_Config",
"isAvailable": false
}
]
}
For more information:
Was this helpful?