toxinlabs toxinlabs - 3 months ago 110x
JSON Question

How to parse link header from github API

the github API sends the pagination data for the json results in the http link header:

Link: <>; rel="next",
<>; rel="last"

since the github API is not the only API using this method (i think) i wanted to ask if someone has a useful little snippet to parse the link header (and convert it to an array for example) so that i can use it for my js app.

i googled around but found nothing useful regarding how to parse pagination from json APIs


There is a PageLinks class in the GitHub Java API that shows how to parse the Link header.