What is your goal?
I want to extract issues from github using pagination
What is the problem?
Match Pattern fails: Failed to map ‘text’: Function ‘first’ finished with error! Function ‘map’ finished with error! ‘{object}’ is not a valid array.
What have you tried so far?
followed the screenshot and the API docs
Screenshots: scenario setup, module configuration, errors
1 Like
Hey Roselle,
Headers in your screenshot is a collection and not an array. So you can access the links directly from it and map() wont work.
thank you for pointing it out.
I noticed that the first API call does not return the link of the last page, and as a result, the flow does not continue to the repeater
1 Like
As far as I understand how github works, the link that has rel=‘next’ after it is the link to the next page.
But you should also be able to get there if you just increment the page number that is just before that.
You are not getting rel=‘last’ cause github doesn’t know it for this endpoint.
So just keep incrementing the page number until a link no longer appears in the header. You can use the increment module for that, followed by the HTTP module, followed by a router. If the link exists, go to the next one. And if it doesn’t exists, force an error to stop the scenario. Like a parse JSON module with a broken JSOn inside.