February 2019
Intermediate to advanced
626 pages
15h 51m
English
Many REST interfaces will return large result sets from searches in pages, a sub-set of the results. The techniques used to retrieve each subsequent page can vary from one API to another.
The GitHub API exposes the link to the next page in the HTTP header. This is consistent with RFC 5988 (https://tools.ietf.org/html/rfc5988#page-6).
In PowerShell Core, it is easy to retrieve and view the header when using Invoke-RestMethod:
$params = @{ Uri = 'https://api.github.com/search/issues' Body = @{ q = 'documentation state:closed repo:powershell/powershell' } ResponseHeadersVariable = 'httpHeader'}Invoke-RestMethod @params | Select-Object -ExpandProperty items
Once run, the link field of the header may be inspected via the
Read now
Unlock full access