I have an existing Publish GP Tool that accepts a couple Parameters. It does its thing and then passes back some results. Something is going on and I want to rewrite this persons code but before doing so I want to make sure I am doing this the most logical way.
The Current project is using API 4.13
SERVICE OVERVIEW
Execution Type: esriExecutionTypeSynchronous
Supported Operations: Execute Task
CREDENTIALS - I need to add to this a Token that the service will require as its secured. How do I add the token
BELOW are the params I am looking to send
NOTING - I need to use the EXECUTE not SUBMIT as that is what the service requires
Can someone help with an example to show me the correct syntax etc to CALL and then grab the RESULTS and simply put in an ALERT box????
let params = {
"site": FeatureSet.fromJSON(
{
"geometryType": geometryType9,
"spatialReference": { "wkid": 102100 },
"features": [
{
"attributes": {
"OBJECTID": 0
},
"geometry": geometry9
}
]
}
),
"Buffer_Distance": LinearUnit.fromJSON({
"distance": xxx.Session.searchRequestTextbox.bufferDistance,
"units": "miles"
}),
"user": UserRole,
"Report_Type": xxxx.Session.searchRequestTextbox.reportType
};
If you're using 4.13, you can use the Geoprocessor task. In current releases, it is deprecated in favor of the if the rest methods here.
Does the later have an actual example....I dont think you can just write execute(xyz,xyz,xyz)
The samples for 4.13 are no longer available.
This sample is still using the GP Task
https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=geoprocessing-hotspot
Here is a sample using the task in 3.x, it's very similar to how you would do it in 4.13 to get another look.
https://developers.arcgis.com/javascript/3/jssamples/gp_viewshed.html