Skip to main content

Hi There, 

 

I am trying to get all list of users/calls/transcripts with api.gong.io endpoints and most of these calls only returns 100 items out of the total records

example:

"records": { "totalRecords": 220, "currentPageSize": 100, "currentPageNumber": 0,

I am trying to get all the records but so far none of my methods seems to be working. I tried to go to Gong documentation and it gives me error 500.

 

Any helps would be appreciated!

Hi Fadly,

As you’ve seen, the Gong API endpoints only return 100 records per HTTP Request.

When you get a response from the API that contains totalRecords > 101 you will also get a key/value pair like “cursor”: “eyJhbGciOiJIUzI1NiJ9.eyJwYWdlU…..”


In short, you need to supply the cursor value within a subsequent HTTP Request to get the “next page” of 100 records and continue making additional requests with the next cursor value until you have retrieved all records. 

 

How you use the cursor value differs depending on the endpoint and request method (GET vs POST).

Here are some examples:

GET https://api.gong.io/v2/users

If there are more than 100 users within Gong, you’ll get a response that looks like…

{
"requestId": "4ubcyx5e25wtaxytgv7",
"records": {
"totalRecords": 215,
"currentPageSize": 100,
"currentPageNumber": 1,
"cursor": "eyJhbGciOiJIUzI1NiJ9.eyJwYWdlU2l6ZSI6MTAwLCJ0b3RhbCI6MjE1LCJwYWdlTnVtYmVyIjoxLCJleHAiOjE3MDcxNzc0NDksInVzZXJJZCI6ODQ5NjI4MDM1ODAwMjA4MjUxMH0.a69Cwz9-9Ufb9Ss2pOcur0Y_tYPE_0TifCuJd7ikt7I"
},
.....
}

So to get the next page of 100 user records you would make the following HTTP Request.

GET https://api.gong.io/v2/users?cursor=eyJhbGciOiJIUzI1NiJ9.eyJwYWdlU2l6ZSI6MTAwLCJ0b3RhbCI6MjE1LCJwYWdlTnVtYmVyIjoxLCJleHAiOjE3MDcxNzc0NDksInVzZXJJZCI6ODQ5NjI4MDM1ODAwMjA4MjUxMH0.a69Cwz9-9Ufb9Ss2pOcur0Y_tYPE_0TifCuJd7ikt7I

 

POST https://api.gong.io/v2/calls/extensive

Similarly, if there are more than 100 calls that meet the provided filter criteria within the POST body the API will respond with a cursor key/value pair.

In such case, you can perform another HTTP Post to https://api.gong.io/v2/calls/extensive. With this subsequent API request you should provide the same JSON Body as before and append the cursor key/value pair to request the next 100 call records.

Here is an example of a POST Body for the /v2/calls/extensive endpoint that requests all available call fields and includes the cursor key/value pair (see: Line 2)

{
"cursor": "abc123",
"contentSelector": {
"context": "Extended",
"contextTiming":
"Now",
"TimeOfCall"
],
"exposedFields": {
"collaboration": {
"publicComments": true
},
"content": {
"pointsOfInterest": true,
"structure": true,
"topics": true,
"trackers": true,
"brief": true,
"outline": true,
"highlights": true,
"callOutcome": true,
"keyPoints": true
},
"interaction": {
"personInteractionStats": true,
"questions": true,
"speakers": true,
"video": true
},
"media": true,
"parties": true
}
},
"filter": {

"fromDateTime": "2018-02-17T02:30:00-08:00"
}
}


I hope this helps! 


Awesome! Thanks!


Reply