How to get results of Custom Objects Search API after page 2 ?



Publicado 07 jul 2021

Hi, I am trying Custom Objects Search API, but I couldn't get all the results of the query. There should be 105 results in the type, but I could get only 102 results.

To get first page,

curl -X POST "https://d3v-eclect-dev.zendesk.com/api/sunshine/objects/query?per_page=100" -d @post.json -H "Content-Type: application/json" -u ...

The content of post.json is,

{
"query": {
"$and": [
{ "_type": {"$eq": "link_tree"} },
{ "setting_id": {"$eq": "TEST"} }
]
},
"sort": {
"path": "asc"
}
}

I got 100 results and links next.

  "links": {
"previous": null,
"next": "/api/sunshine/objects/query?per_page=100&cursor=MjAyMS0wNy0wNlQwMjo0ODoyMC44ODVa"
}

To get second page, I used the next link,

curl -X POST "https://d3v-eclect-dev.zendesk.com/api/sunshine/objects/query?per_page=100&cursor=MjAyMS0wNy0wNlQwMjo0ODoyMC44ODVa" -d @post.json -H "Content-Type: application/json" -u ...

But, there were only 2 results in the response. 3 results were missing.

I could get all the results by List Object Records API and there were 105 results that matches "setting_id": {"$eq": "TEST"}.

 

How can I get all the results by Search API ?

( I tried post json without sort param, but the results were the same. )


0

4

4 comentarios

Thanks Eric,

Please put this into a ticket, I will provide account specific information.

0


Hey Megumi,

Thanks for confirming, just wanted to confirm as sometimes people will update the object_type_key and it can cause this issue. You mind if I pull this into a ticket so I can get some account specific information?

Thanks,

Have a wonderful day!

Eric Nelson | Manager - Developer Advocacy

0


Hi Eric,

Of course the 3 are in the type. It can be fetched by list API /api/sunshine/objects/records?type={object_type}.

0


Hey Megumi,

Could it be possible that 3 of your records are missing the 'type' of 'link_tree'? You could do

"_type": {"$eq": "link_tree"} 

and check the results to see if that's the issue.

Thanks,

Eric

0


Iniciar sesión para dejar un comentario.

¿No encontró lo que buscaba?

Nueva publicación