Intercept Map Request

800
6
Jump to solution
01-10-2022 06:12 AM
BartVan_Hoecke1
New Contributor

Hi,

I'm wondering if the ArcGIS Pro API allows to be triggered just before a request is made to a Feature service. So I could add some extra metadata?

Similar to the esriRequest.setRequestPreCallback(callbackFunction) in JavaScript 3.3?

Thx,
Bart

0 Kudos
1 Solution

Accepted Solutions
CharlesMacleod
Esri Regular Contributor

as currently, u would need to use the CIM and access the DataConnection. Any DataConnection of a service layer that has a "CustomParameters" member can have custom parameters set that will be appended to the URL.

so something like.....

//on the QueuedTask

var dc = serviceLayer.GetDataConnection() as CIMAGSServiceConnection;
CIMStringMap[] customParams = { new CIMStringMap { Key = "custom1", Value = "12345" }, new CIMStringMap { .... etc ....} };
dc.CustomParameters = customParams;
serviceLayer.SetDataConnection(dc);

 

The complete set of data connection types for service layers can be seen in the hierarchy diagram here:

 https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/#topic4980.html 

View solution in original post

0 Kudos
6 Replies
RussellBrennan
Esri Contributor

Hi Bart,

Can you explain a bit more about what you would like to do with this API. I don't think we have anything at the moment but would like to understand your use case a bit better.

 

Thanks,

Russell

0 Kudos
BartVan_Hoecke1
New Contributor

Hi Russell,

Well we are allowing the same FeatureServices to be edited by two audiences: 1 using ArcGIS Pro (with an AddIn) & the other using an in-house webviewer using the JS API.

Without changing the dataset, we would like to append some meta information to these FeatureService requests, like the 'type of user: dekptop,webviewer' and so on.

On the FeatureService side, we would like to read out that information using an SOI, for building in some monitoring and validation.

Thx,

Bart

0 Kudos
CharlesMacleod
Esri Regular Contributor

we are looking at allowing an addin to define custom parameters when the connection to the layer is created (i.e. via the call to LayerFactory.Instance.CreateLayer(......) in code). Custom parameters defined as part of "creating" the layer connection via LayerFactory would automatically be appended to the URL of the service layer each time Pro "called" it (eg on a select, refresh, etc)

This would be in 3.0 - our next release.

BartVan_Hoecke1
New Contributor

ok, sounds like nice feature. We indeed use the LayerFactory already, so I think it might work out for what we need.

But it does mean, that any feature that's being added through standard Catalog will not run through that and will not have the custom parameters added? Just for my understanding.

0 Kudos
CharlesMacleod
Esri Regular Contributor

as currently, u would need to use the CIM and access the DataConnection. Any DataConnection of a service layer that has a "CustomParameters" member can have custom parameters set that will be appended to the URL.

so something like.....

//on the QueuedTask

var dc = serviceLayer.GetDataConnection() as CIMAGSServiceConnection;
CIMStringMap[] customParams = { new CIMStringMap { Key = "custom1", Value = "12345" }, new CIMStringMap { .... etc ....} };
dc.CustomParameters = customParams;
serviceLayer.SetDataConnection(dc);

 

The complete set of data connection types for service layers can be seen in the hierarchy diagram here:

 https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/#topic4980.html 

0 Kudos
BartVan_Hoecke1
New Contributor

Ah great!. That even seems available from 2.8 on... I'll need to look into that.

Thanks,

Bart

0 Kudos