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.setEndpoint(SCHEDULEURL);
restMessage.setHttpMethod(“get”);
restMessage.setRequestHeader(“Authorization”,“Token token=”+ TOKEN);
restMessage.setRequestHeader(“Accept”,“application/vnd.pagerduty+json;version=2”);
restMessage.setRequestHeader(“Content-Type”, “application/json”);
var response = restMessage.execute();
gs.log("response - "+response.getBody());
gs.log(response.getStatusCode());

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?

Cheers,

Nadia Simmons
Technical Support Specialist
PagerDuty Support