Hi
For a particular situation, in ArcGIS for JS API 4.15 I am trying to force a particular format of all Feature Server (FS) queries to JSON (f=json, or f=pjson), regardless of the ArcGIS Server's (10.7.1) > Feature Service's > Layer config params, such as SupportedQueryFormats: JSON, GeoJSON, PBF. It looks like PBF is preferred to be used by clients, if it is available.
I have forced f=json with esri.Config.request successfully:
require([ "esri/config", ... ], function(esriConfig,...) { esriConfig.request.interceptors.push({ before(params) { if (params.url.includes("query")) { params.requestOptions.query.f = 'json'; } } } ... });
which works at the call level. However when the query is originally PBF, the client JS SDK is expecting it to come back and be parsed as PBF still, even though I have intercepted the initial request. I know this because the FL does not display on the web map and I get the console error:
dojo-lite.js:261 [esri.tasks.operations.pbfFeatureServiceParser]
Is this a bug in ArcGIS for JS API?
Is there a more robust way to change the FS query format from the client?
Solved! Go to Solution.
Hi Shanon,
We don't have a proper way to disable pbf at the moment. You are on the right track to use interceptors.
It would work if you intercept the call to the service info, and override the supported query formats to only have JSON.
esriConfig.request.interceptors.push({
urls: /FeatureServer\/\d+$/,
after: function (response) {
response.data.supportedQueryFormats = "JSON";
}
});
Cheers
Yann
Hi Shanon,
We don't have a proper way to disable pbf at the moment. You are on the right track to use interceptors.
It would work if you intercept the call to the service info, and override the supported query formats to only have JSON.
esriConfig.request.interceptors.push({
urls: /FeatureServer\/\d+$/,
after: function (response) {
response.data.supportedQueryFormats = "JSON";
}
});
Cheers
Yann
@ArnoFiva @ShanonLoughton @YannCabon
Does the interceptors solution you have provided work with JS API 3.x version?
@viewprogisdev - at 3x, we have a setRequestPreCallback method that is fairly similar. See here:
has this been addressed? We are having trouble serving pbf files. WE need to disable from the server side as we cannot control what the application requests.
@JeffPace1 @ShanonLoughton I am having a similar issue. Did either of you ever figure out a resolution?