Unable to get Final Schedule using Schedule API

I am trying to fetch the final schedule of a schedule via API, but it’s returning an empty array i.e. rendered_schedule_entries = [].
“final_schedule”: {
“name”: “Final Schedule”,
“rendered_schedule_entries”: [],
“rendered_coverage_percentage”: null

My script:
var TOKEN="";
var SCHEDULEURL=“https://api.pagerduty.com/schedules/PFGR6EV?time_zone=UTC&since=2020-01-01”;

var restMessage = new sn_ws.RESTMessageV2();
restMessage.setRequestHeader(“Authorization”,“Token token=”+ TOKEN);
restMessage.setRequestHeader(“Content-Type”, “application/json”);
var response = restMessage.execute();
gs.log("response - "+response.getBody());

Hey Snehangshu,

I recommend to check out our developer documentation on this endpoint: (https://v2.developer.pagerduty.com/v2/page/api-reference#!/Schedules/get_schedules_id and selecting the “Show samples” button at the top right of the page. This will show you a response sample and the response schema as well.

Can you share with us the API call you made with your API key redacted?


Nadia Simmons
Technical Support Specialist
PagerDuty Support