Context: We have a deployment job that gets all newsletters for a site from the Letterhead API and saves them to the site's archive page. The LH API will return 10 results max, so if a site has more than 10 newsletters, only 10 are returned. We need to edit the query to get all newsletters. Ideally, when we switch to automated newsletter publishing (#1277), we should get the last N newsletters that were published since we last updated it and update the page with only what's changed.
Manual repro steps:
Create a GET request to the LH API: https://api.tryletterhead.com/api/v2/channels/<CHANNEL_SLUG_GOES_HERE>/letters?api=true. You will need to use the LH API token for authorization and the channel slug for the specific site.
Observe the size of the items list versus the total field. The total field includes all newsletters and welcome letters. However, items only shows 10 items. We need all items.
Context: We have a deployment job that gets all newsletters for a site from the Letterhead API and saves them to the site's archive page. The LH API will return 10 results max, so if a site has more than 10 newsletters, only 10 are returned. We need to edit the query to get all newsletters. Ideally, when we switch to automated newsletter publishing (#1277), we should get the last N newsletters that were published since we last updated it and update the page with only what's changed.
Manual repro steps:
https://api.tryletterhead.com/api/v2/channels/<CHANNEL_SLUG_GOES_HERE>/letters?api=true
. You will need to use the LH API token for authorization and the channel slug for the specific site.items
list versus thetotal
field. Thetotal
field includes all newsletters and welcome letters. However,items
only shows 10 items. We need all items.Suggested fix: LH suggested we set a large limit in the request to get all items (https://api.tryletterhead.com/api/v2/channels//letters?api=true&limit=999999).