On ArcGIS API for JavaScript, how can we force QueryTask to always perform POST requests?

I know that I can force POST for esriRequest via the usePost options parameter. Perhaps a similar, undocumented, method exists for the rest of the API?

My application specifications require all requests to be performed via POST. So, a solution applicable to all ArcGIS API for JavaScript requests would be even better.

2 Answers 2


you can't control the request method which will be used artificially, but you could tack on a meaningless additional request parameter to ensure that the request exceeds 2000 characters and achieve the same thing.

var moreText = "%20AND%201%3D1%20";
var moreTextArray = [];
for (var i=0;i<125;i++) {

query.where = "FIELD = 'value'" + moreTextArray.join("");
// resulting unencoded where clause: FIELD = 'value' AND 1=1 AND 1=1 AND ...

if you are attempting to POST across domains, standard Cross Origin rules apply, so you'll either need to ensure that the browser supports CORS or you have a proxy in place to help issue the request.


As of 2017-11 there is a way to do so in JSAPI 3.20. You can force to POST with the below line:

queryTask.requestOptions = {usePost:true}

Actually, it is documented in the JSAPI 4.X documentation, though not listed in 3.X, it still works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.