Call the Mongo Cloud API, encounter the disorder of the paging sequence

Hi, all
I have 4 records and want to page them

test, test1, test2, test3, these four records

https://cloud.mongodb.com/api/public/v1.0/orgs/60d57116285b371238207fab/apiKeys?pretty=true&itemsPerPage=2&pageNum=1
got test2 test3

https://cloud.mongodb.com/api/public/v1.0/orgs/60d57116285b371238207fab/apiKeys?pretty=true&itemsPerPage=2&pageNum=2
got test1 test3

how can i fix it?

Thanks

Hi @Long_Wang,

Welcome to the MongoDB Community! :slight_smile:

I have 4 records and want to page them
test, test1, test2, test3, these four records

Are you attempting to query data from an Atlas cluster using the Atlas API? If so, this is not possible. The Atlas API is used for administrative functions within Atlas. If you wish to query data from the cluster, you can use a MongoDB driver.

However, if I am incorrect in my assumption above, please let me know.

Kind Regards,
Jason

1 Like

I use curl tool call API:

curl --user "" --digest "https://cloud.mongodb.com/api/public/v1.0/orgs/60d57116285b371238207fab/apiKeys?pretty=true&itemsPerPage=4&pageNum=1"
{
  "links" : [ {
    "href" : "https://cloud.mongodb.com/api/public/v1.0/orgs/60d57116285b371238207fab/apiKeys?pretty=true&pageNum=1&itemsPerPage=4",
    "rel" : "self"
  } ],
  "results" : [ {
    "desc" : "test",
    "id" : "60d93fdc63175e73a613300d",
    "links" : [ {
      "href" : "https://cloud.mongodb.com/api/public/v1.0/orgs/60d57116285b371238207fab/apiKeys/60d93fdc63175e73a613300d",
      "rel" : "self"
    } ],
    "privateKey" : "********-****-****-29b31f40c9d6",
    "publicKey" : "chhxlwzz",
    "roles" : [ {
      "orgId" : "60d57116285b371238207fab",
      "roleName" : "ORG_OWNER"
    }, {
      "orgId" : "60d57116285b371238207fab",
      "roleName" : "ORG_MEMBER"
    } ]
  }, {
    "desc" : "test2",
    "id" : "60dac65846a234239da90e12",
    "links" : [ {
      "href" : "https://cloud.mongodb.com/api/public/v1.0/orgs/60d57116285b371238207fab/apiKeys/60dac65846a234239da90e12",
      "rel" : "self"
    } ],
    "privateKey" : "********-****-****-5d8ecff2cdce",
    "publicKey" : "qqcbmqyk",
    "roles" : [ {
      "orgId" : "60d57116285b371238207fab",
      "roleName" : "ORG_MEMBER"
    } ]
  }, {
    "desc" : "test1",
    "id" : "60dac64f7463305eed329a88",
    "links" : [ {
      "href" : "https://cloud.mongodb.com/api/public/v1.0/orgs/60d57116285b371238207fab/apiKeys/60dac64f7463305eed329a88",
      "rel" : "self"
    } ],
    "privateKey" : "********-****-****-b65d98aa5c7a",
    "publicKey" : "dlioptir",
    "roles" : [ {
      "orgId" : "60d57116285b371238207fab",
      "roleName" : "ORG_MEMBER"
    } ]
  }, {
    "desc" : "test3",
    "id" : "60dac66322c4ae3e6bec24f1",
    "links" : [ {
      "href" : "https://cloud.mongodb.com/api/public/v1.0/orgs/60d57116285b371238207fab/apiKeys/60dac66322c4ae3e6bec24f1",
      "rel" : "self"
    } ],
    "privateKey" : "********-****-****-e4f1da99f54c",
    "publicKey" : "acnjcnsj",
    "roles" : [ {
      "orgId" : "60d57116285b371238207fab",
      "roleName" : "ORG_MEMBER"
    } ]
  } ],
  "totalCount" : 4
}%      
 curl --user "" --digest "https://cloud.mongodb.com/api/public/v1.0/orgs/60d57116285b371238207fab/apiKeys?pretty=true&itemsPerPage=3&pageNum=1"
{
  "links" : [ {
    "href" : "https://cloud.mongodb.com/api/public/v1.0/orgs/60d57116285b371238207fab/apiKeys?pretty=true&pageNum=1&itemsPerPage=3",
    "rel" : "self"
  }, {
    "href" : "https://cloud.mongodb.com/api/public/v1.0/orgs/60d57116285b371238207fab/apiKeys?pretty=true&itemsPerPage=3&pageNum=2",
    "rel" : "next"
  } ],
  "results" : [ {
    "desc" : "test2",
    "id" : "60dac65846a234239da90e12",
    "links" : [ {
      "href" : "https://cloud.mongodb.com/api/public/v1.0/orgs/60d57116285b371238207fab/apiKeys/60dac65846a234239da90e12",
      "rel" : "self"
    } ],
    "privateKey" : "********-****-****-5d8ecff2cdce",
    "publicKey" : "qqcbmqyk",
    "roles" : [ {
      "orgId" : "60d57116285b371238207fab",
      "roleName" : "ORG_MEMBER"
    } ]
  }, {
    "desc" : "test",
    "id" : "60d93fdc63175e73a613300d",
    "links" : [ {
      "href" : "https://cloud.mongodb.com/api/public/v1.0/orgs/60d57116285b371238207fab/apiKeys/60d93fdc63175e73a613300d",
      "rel" : "self"
    } ],
    "privateKey" : "********-****-****-29b31f40c9d6",
    "publicKey" : "chhxlwzz",
    "roles" : [ {
      "orgId" : "60d57116285b371238207fab",
      "roleName" : "ORG_MEMBER"
    }, {
      "orgId" : "60d57116285b371238207fab",
      "roleName" : "ORG_OWNER"
    } ]
  }, {
    "desc" : "test3",
    "id" : "60dac66322c4ae3e6bec24f1",
    "links" : [ {
      "href" : "https://cloud.mongodb.com/api/public/v1.0/orgs/60d57116285b371238207fab/apiKeys/60dac66322c4ae3e6bec24f1",
      "rel" : "self"
    } ],
    "privateKey" : "********-****-****-e4f1da99f54c",
    "publicKey" : "acnjcnsj",
    "roles" : [ {
      "orgId" : "60d57116285b371238207fab",
      "roleName" : "ORG_MEMBER"
    } ]
  } ],
  "totalCount" : 4
}% 
curl --user "" --digest "https://cloud.mongodb.com/api/public/v1.0/orgs/60d57116285b371238207fab/apiKeys?pretty=true&itemsPerPage=3&pageNum=2"
{
  "links" : [ {
    "href" : "https://cloud.mongodb.com/api/public/v1.0/orgs/60d57116285b371238207fab/apiKeys?pretty=true&pageNum=2&itemsPerPage=3",
    "rel" : "self"
  }, {
    "href" : "https://cloud.mongodb.com/api/public/v1.0/orgs/60d57116285b371238207fab/apiKeys?pretty=true&itemsPerPage=3&pageNum=1",
    "rel" : "previous"
  } ],
  "results" : [ {
    "desc" : "test2",
    "id" : "60dac65846a234239da90e12",
    "links" : [ {
      "href" : "https://cloud.mongodb.com/api/public/v1.0/orgs/60d57116285b371238207fab/apiKeys/60dac65846a234239da90e12",
      "rel" : "self"
    } ],
    "privateKey" : "********-****-****-5d8ecff2cdce",
    "publicKey" : "qqcbmqyk",
    "roles" : [ {
      "orgId" : "60d57116285b371238207fab",
      "roleName" : "ORG_MEMBER"
    } ]
  } ],
  "totalCount" : 4
}%  

test2 is a duplicate

Hi @Long_Wang,

test2 is a duplicate

After some testing on my own environment I’ve confirmed what you are experiencing is a bug and I have raised an internal issue to investigate it further.

Kind Regards,
Jason

2 Likes

If it is fixed, please tell me, thanks