question

Scott McCain avatar image
Scott McCain asked ·

GLIP - Team List With Page Token Not Working

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


api group
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered ·

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

1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Dhanaraj Durairaj avatar image
Dhanaraj Durairaj answered ·

@Phong Vu

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

1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys