400: Invalid Cursor

While requesting pages with the new helix API, I keep getting an Invalid Cursor error when I try and request successive pages. This occurs when I try and use after or before. Am I using the new paging wrong or is it just borked?

public static async Task<List<return_type>> GetAllPagesAsync<return_type, page_return_type, paging_parameters>(Func<Authentication, string, paging_parameters, Task<page_return_type>> GetPage, Authentication authentication, string token, paging_parameters parameters)
where paging_parameters : new()
    List<return_type> result = new List<return_type>();

    bool requesting = true;

        // request the page
        page_return_type page = await GetPage(authentication, token, parameters);
        PropertyInfo page_data = page.GetType().GetProperty("data");

        List<return_type> page_data_value = (List<return_type>)page_data.GetValue(page);
        foreach (return_type element in page_data_value)

        // check to see if there is a new page to request
        PropertyInfo page_pagination = page.GetType().GetProperty("pagination");
        Pagination pagination = (Pagination)page_pagination.GetValue(page);
        if (pagination.cursor.isValid())
            // TODO: (PagingUtil.GetAllPagesAsync) - Fix invalid cursor
            // update the parameter's 'after' property to properly request the next page
            PropertyInfo parameters_after = parameters.GetType().GetProperty("after");
            parameters_after.SetValue(parameters, pagination.cursor);
            requesting = false;
    while (requesting);

    return result;

Can you post an example of your code so we can perhaps see what might be the problem.

Updated the original post with my function.

Okay, let’s go at this from a different angle. Has anyone actually had success with the new cursor/paging?


Yeah, after this post I figured out that the cursor should be the “first” or “after” parameter for user/follows.
With that, it work’s as expected.

My suggestion would be that you just echo the path you are trying to access and see if that looks good.

I figured it out after blankly staring at my screen for a while. I forgot I was .ToLower()-ing all my query parameters by default and that the cursor is case sensitive. Talk about a blonde moment lol.

1 Like

Great you figured it out at least :wink:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.