First off I have 15 items in a collection.
1- this query only returns 10 items: qs:{ql:"name = '*'"}
2- this query only returns 10 items: qs:{ql:"name = '*' limit=20"}
3- this query qs:{ql:"name = '*' & limit=20"} return this error: “Error (400)(query_token): MismatchedTokenException(32!=38)”
4- this query returns 0 items: qs:{ql:"name = '*' and limit=20"}
Looking for some help with syntax.
This is a free account, is it possible Apigee is limiting all queries to 10 ???
I know the default is 10 but you can get more by setting the limit to a higher number.
I followed the info for Node.js at the link:
http://docs.apigee.com/app-services/content/querying-your-data
SAMPLE CODE:
//==========================================
RemoteController.getAllLevelWords = function() { var allLevelObj = { endpoint:"levelwords", qs:{ql:"name = '*' & limit=20"}}; client.request(allLevelObj, function (error, response) { if (error){ console.log("getAllLevelWords error = "+ error); } else { console.log("getAllLevelWords response = "+response);} }); };
limit should be it's own query parameter. It looks like your code may URL encode that & symbol rather than treating it as a second query param. Can you try making a call directly from your browser or an API client with limit as a separate URL query parameter and see if the behavior changes?
clatimer1 : I tried 2 additional ways and neither one works. Any more suggestions?
Remember I started following the instructions from Apigee web site, so putting the limit inside the one query is what is recommended.
This one returned zero records:
var allLevelObj = {
endpoint:"levelwords",
qs:{ql:"name = '*'"},
qs:{ql:"limit=20"}
};
This one returned 10 records: (added a comma)
var allLevelObj = {
endpoint:"levelwords",
qs:{ql:"name = '*', limit=20"}
};
try this:
var allLevelObj = { endpoint:"levelwords", qs:{ql:'name = *', limit:20} };
Answer by Dino
·
Jun 28, 2016 at 11:20 PM
I think there's a typo (Sorry!) in that documentation page.
I believe the correct syntax is:
RemoteController.getAllLevelWords = function() { var allLevelObj = { endpoint:"levelwords", qs:{ ql:"name = *", limit: 20} // note - limit is a separate property }; client.request(allLevelObj, function (error, response) { if (error){ console.log("getAllLevelWords error = "+ error); } else { console.log("getAllLevelWords response = "+response);} }); };
Finally got it to work with: thanks Dino
var allLevelObj = { endpoint:"levelwords", qs:{ql:"name = '*'", limit:20} };