Hi Clara,
I can only think of ways to do this via API. The approach I was able to come up with was to first use GET /schedules/{id} on the schedule and then generate overrides based on entries of the “rendered_schedule_entries” property inside of the “final_schedule” property, which lists entries of the schedule. Note that to constrain the entries to the desired week, you will need to use the “since” and “until” query parameters when making this initial request.
It is also possible to use the “rendered_schedule_entries” property of the desired layer within the “layers” property (each entry has a “Name” property that can be used to identify it), but if the need is to target a user for overrides, using “final_schedule” is the more reliable approach because it will take into account preexisting schedule overrides and superseding schedule layers that can add or remove shifts of that user. Moreover, using “final_schedule” is idempotent; if there are no schedule entries after creating overrides the first time, no new overrides will be created because the user will have no shifts in the schedule for the given time range.
After getting the schedule entries, take each entry matching the user’s ID from that list and use it to compose a list of overrides. That can then be used to create the overrides via POST /schedules/{id}/overrides. Each override in the list is an object as follows:
- The “start” and “end” property map to the original schedule entry
- The “user” property should be a resource reference (an object with “id” and “type” properties) specifying the user to be on-call for the override
Reply
Login to PagerDuty Commons
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.