https://linen.dev logo
#singer-tap-development
Title
# singer-tap-development
d

dustin_miller

10/01/2021, 11:13 PM
Following up on @visch’s post: I’m in the process of building a ClickUp tap, and his first item is where I’m stuck right now. What’s the best practice for handling APIs that don’t return pagination hints for a given endpoint? ClickUp’s Get Tasks operation doesn’t provide a record count total, nor does it provide pagination hints/props. It uses a
page
0-based index for requests, and returns a maximum of 100 items. Unfortunately, if there are less than 100 items, and you pass a
page
querystring param that should return 0 rows, it merrily returns the complete set of records. For example, this request (using ClickUp’s Apiary Mock endpoint, so you can run it as-is) returns a list of valid workspaces for the ClickUp Team with a
team_id
of `512`:
Copy code
curl <https://private-anon-1ab3e1ce0e-clickup20.apiary-mock.com/api/v2/team/512/space>
Note that there are only two workspaces in the response. With a maximum of 100 records per-page, adding a
page
querystring param should return zero records. However, If I add a
page
querystring param (per the API docs) to return the “next” page of records…
Copy code
curl <https://private-anon-1ab3e1ce0e-clickup20.apiary-mock.com/api/v2/team/512/space?page=1>
I get back the same two entries. This is true for live API requests, also. Is there a recommended approach for dealing with APIs like this? That is, other than submitting a request to ClickUp to fix their API, which I have already done. 😄