freshworks / freshworks-api-sdk

Node.js client SDK for Freshworks' REST APIs, currently in beta. Supports Freshteam and Freshservice (partially).
https://developers.freshworks.com/api-sdk/
MIT License
6 stars 2 forks source link

Pagination headers need to be returned from response of pagination-capable endpoints #67

Closed kaustavdm closed 1 year ago

kaustavdm commented 2 years ago

I tried to use the API SDK for the first time in a data-sync use case, and I found that we need to be able to pass response headers back to the user. Currently, we ignore headers and just send the response data as objects.

But, consider this, when calling GET /employees, pagination details are sent using the response headers total-objects, total-pages and link (URL to the next page). So, if I am running a scheduled function that syncs the list of Freshteam employees to another system, then the scheduled function needs to remember the link or the total-pages value to fetch the next page.