Question

GLIP - Team List With Page Token Not Working

  • 4 September 2020
  • 2 replies
  • 524 views

I am trying to get all the teams associated with a particular login. I know there are more than 250 teams in this example. When I use either the .Net SDK or calling the endpoint directly I never receive a nextPageToken value (even though there are far more than 250 teams). I do receive a prevPageToken, but if I assign that to the pageToken of the query parameters I receive an error:

RestException: Response:
StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
  Connection: keep-alive
  RCRequestId: 653444c4-ee73-11ea-aaee-0050568c8430
  X-Request-Id: reqId:653444c4-ee73-11ea-aaee-0050568c8430;accId:2195291011;extId:2557875011
  X-HLB-Server: sjc01-c01-hlb32
  X-HLB-Connection: 50027820
  X-HLB-RequestId: df65aa11c9c684941c503f539eb3a7c4
  X-HLB-Upstream-Server: 10.13.22.98:54301
  X-HLB-Upstream-Status: 400
  X-Rate-Limit-Group: medium
  X-Rate-Limit-Limit: 60
  X-Rate-Limit-Remaining: 59
  X-Rate-Limit-Window: 60
  RoutingKey: IAD01P04
  Date: Fri, 04 Sep 2020 05:56:37 GMT
  ETag: W/"74-Qo1hxy00ZvJ+5ivUzGjLpg"
  Server: nginx
  Content-Length: 116
  Content-Type: application/json; charset=utf-8
}
Content: {"errors":[{"errorCode":"CMN-101","message":"Parameter [pageToken] value is invalid.","parameterName":"pageToken"}]}

Request:
Method: GET, RequestUri: 'https://platform.ringcentral.com/restapi/v1.0/glip/teams?pageToken=H4sIAAAAAAACAx2MSwqFMBAE79LrWWhCnLw5h7uQRdAIAX+YKIh4d31uelFF9YUDUhPKtyPkQuoh2jRcW6vZKsIRxj2+3rBSVivWbH43IfdfkwcIui2Gkpa5TVMEYevei4owZIhzKOf6p2kGObQxTPDe3w9OfmAFewAAAA==', Version: 1.1, Content: <null>, Headers:
{
  X-User-Agent: Unknown/0.0.1 RingCentral.Net/4.1.0
  Authorization: Bearer XXXREDACTEDXXX
 }


Here is my code for reference:

            var navigation = new GlipNavigationInfo();
            do
            {
                   var queryParameters = new ListGlipTeamsParameters { pageToken = navigation.nextPageToken };  // nextPageToken is always null, and using prevPageToken results in an error

                var teams = _client.Restapi().Glip().Teams().List(queryParameters).Result;
                foreach (var team in teams.records)
                {
                    yield return team;
                }

                navigation = teams.navigation;

            } while (navigation.nextPageToken != null);  // nextPageToken is always null, and using prevPageToken results in an error



2 replies

Userlevel 1

It is a reversed list with new first and oldest last. So use the prevPageToken to read "next" block.

@Phong Vu

Using prevPageToken in the request results in error as specified in this post. How to deal with this?

Reply