Post

2 followers Follow
0
Avatar

API.Objects.query not returning all results

Hi,

I'm trying to run a query through a custom page within Clarizen using the API but am having an issue where it is only returning 100 results. I see in customPanelApi.js that the query function accounts for hasMore but not all the data is being returned when the API.Objects.query function is called. How can I have the following API call return all results? Please see code below:

var CZQL = "SELECT SYSID FROM EnhancementRequest WHERE NOT C_BlahBlah = null";
API.Objects.query(CZQL,function(results){
//Do stuff here
});
});

Thanks.

Erwin Hernandez Answered

Please sign in to leave a comment.

3 comments

0
Avatar

Hi Erwin,

With performance and security in mind, the API limits the no. of results returned for a single API call.

The default maximum is 100, but you can raise it up to 1,000 and/or make subsequent calls to retrieve more results. To achieve that you have to use the paging property.

Please check the documentation for further information.

Hope this helps,

Ophir

Ophir Kenig 0 votes
Comment actions Permalink
0
Avatar

Hi Ophir,

Using the paging property, the request is not respecting the from parameter in the CZQL query. It doesn't matter what I pass into the following function for numRequests/pageSize, it always returns the same set of objects. I was hoping to just call this function until paging.hasMore = false to build to full data set but since it always returns the same set of objects, paging.hasMore is always true. Please advise.

function APIGetAllCartusRequests(numRequests, pageSize, method, url, body, callback){
var bulkPayload = {
requests: [
{
url: "/data/query?q=SELECT SYSID FROM EnhancementRequest WHERE NOT C_BlahBlah = null&paging={from:" + (numRequests + 1).toString() + ",limit:" + pageSize.toString() + "}",
method: 'GET'
}
]
};
API.Server.post("/bulk/execute", bulkPayload, callback);
}

Erwin Hernandez 0 votes
Comment actions Permalink