iosnetwork-programmingrequest

iOS Marvel API: How to get all Characters


I'm coding a simple Objective-C app as a request for a school Project.

I have to use the Marvel API to retrieve all the Marvel Characters, ALL of them.

But there is a kind of limit in the API getting the characters, in the beginning I was thinking that there were different pages for the characters list, but than I couldn't find any reference to it. Than I saw a query parameter named limit: Limit the result set to the specified number of resources.

So I've decided to try with the limit parameter set at his max, 100, and it works, it gets 100 characters. But the characters in total are like 1000.

Without setting the parameter limit I get like 20 characters.

Here is the code I've done so far. I'm Using AFNetworking pod. Github link

Here is the API Doc

Please help me to figure it with is the logic to request all the 1000+ characters from the marvel API.


Solution

  • Sounds like the trick that you'll need to implement is to actually trigger several HTTP requests where the offset parameter is incremented based on the limit requested in the prior requests.

    It would look like this: