I am using this function to navigate to the next link
It’s in VBA but should be easy to translate it.
Function getNextPageURL(ByRef linkHeader As String) As String
Dim linkArray() As String: linkArray = Split(linkHeader, ",")
For Each link In linkArray
link = Trim(link)
Dim linkfields() As String: linkfields = Split(link, ">;")
If linkfields(1) Like "*next*" Then
getNextPageURL = Right(linkfields(0), Len(linkfields(0)) - 1)
Exit Function
Else
getNextPageURL = ""
End If
Next link
End Function
It only finds the next link as I never need to go back
Also I wrote this specifically for Shopify APIs so there are good chances that it won’t work with other applications.