2

I have an InstaSharp.Endpoints.Relationships.Authenticated object EP_RELATIONSHIPS, and I can call EP_RELATIONSHIPS.Follows() to get a list of users I'm following. I follow a few hundred people, but I only get a result of 50.

When I check the JSON data on the Instagram API page using the API Console, I can see that there's a pagination URL.

Other return objects such as InstaSharp.Model.Responses.MediasResponse have an object called .Pagination that seem to provide this functionality.

Is this library incomplete? Why is there no pagination in the Relationships endpoint response and how can I accomplish pagination without having to re-write my own version of this part of InstaSharp?

Dave Cousineau
  • 12,154
  • 8
  • 64
  • 80
user1002358
  • 2,852
  • 6
  • 22
  • 32

3 Answers3

3

The latest version of Instasharp (https://github.com/InstaSharp/InstaSharp) has the 'Pagination' property in the class.

There is also an implementation of the pagination being used to return multiple page sets in the library also in the Tags.RecentMultiplePages(..) method, which could in the future be made more generic and rolled out to multiple methods.

Damian Green
  • 6,895
  • 2
  • 31
  • 43
0

You could create your own object that has the pagination -> next_url | next_cursor. Grab the json from the response and Deserialize it into your own object..

S Philp
  • 452
  • 3
  • 14
0

To further clarify Damian's answer, if you look at the unit tests on the InstaSharp github, you can see an example of how to use Pagination:

    public async Task Follows_NextCursor()
    {
        //This test will fail if testing with an account with less than one page of follows
        var result = await relationships.Follows();
        result = await relationships.Follows(457273003/*ffujiy*/, result.Pagination.NextCursor);
        Assert.IsTrue(result.Data.Count > 0);
    }
Community
  • 1
  • 1
TaRDy
  • 999
  • 1
  • 8
  • 21