Hello! I am writing some Go code, to retrieve users from endpoint:
https://cliq.zoho.com/api/v2/users, and I want to test the pagination so I send a limit of 1 and loop over the returned `next_token` until I get `has_more` set to false.
I have three users, and instead of returning all 3 of them, it is returning twice the first one. I put some printfs in the middle of the execution, and this is what's happening:
- "GET users?fields=all&limit=1"
- "Returned data " zohocliq.listUserType{
- NextToken: "46ccbe60d0404344dcb5034327c77445baa9dcd491427bda5106e14aab793085",
- HasMore: true,
- Data: []zohocliq.userType{
- zohocliq.userType{
- Name: "Cccccc",
- DisplayName: "Cccccc",
- EmailID: "Ccccccvvvvvv@gmail.com",
- ID: "12341234",
- Type: "paid",
- },
- },
- }
- "GET users?fields=all&limit=1&next_token=46ccbe60d0404344dcb5034327c77445baa9dcd491427bda5106e14aab793085"
- "Returned data " zohocliq.listUserType{
- NextToken: "9ba5efc5d7db3ebcdafb0cdc1c93fd02baa9dcd491427bda5106e14aab793085",
- HasMore: true,
- Data: []zohocliq.userType{
- zohocliq.userType{
- Name: "Cccccc",
- DisplayName: "Cccccc",
- EmailID: "Ccccccvvvvvv@gmail.com",
- ID: "12341234",
- Type: "paid",
- },
- },
- }
- "GET users?fields=all&limit=1&next_token=9ba5efc5d7db3ebcdafb0cdc1c93fd02baa9dcd491427bda5106e14aab793085"
- "Returned data " zohocliq.listUserType{
- NextToken: "16bf27a63e1c88cbefe4baf75c819777baa9dcd491427bda5106e14aab793085",
- HasMore: true,
- Data: []zohocliq.userType{
- zohocliq.userType{
- Name: "dev devlast",
- DisplayName: "dev devlast",
- EmailID: "dev@ddd-oooooo.net",
- ID: "66667777",
- Type: "paid",
- },
- },
- }
- "GET users?fields=all&limit=1&next_token=16bf27a63e1c88cbefe4baf75c819777baa9dcd491427bda5106e14aab793085"
- "Returned data " zohocliq.listUserType{
- NextToken: "",
- HasMore: false,
- Data: []zohocliq.userType{
- zohocliq.userType{
- Name: "Test Account3",
- DisplayName: "Test Account3",
- EmailID: "Cccccc.pppp@sssss.aaaa",
- ID: "00009999",
- Type: "paid",
- },
- },
- }
On the first call, I pass no `next_token` because, well, I have none. So the api returns a user, and a next token. When I use this token, I get a duplicate of the data, and I don't know exactly why.