Issue with rest/geoprocessor typescript 4.20

539
1
07-19-2021 11:35 AM
MatthieuThery1
Occasional Contributor

Hello,

There seems to be at least a typing error in the geoprocessor rest.

When I submit an async geoprocess like below:

 

const jobSubmitted = await submitJob(url, params);

 

 
If I want to fetch I need to use fetchResultData.

 

fetchResultData(jobId: string, resultName: string, requestOptions?: any, Promise<supportParameterValue>;

 

 
Then if I do 
 

 

const output = await jobSubmitted.fetchResultData(jobId, resultName);

 

It returns an error. In the network tab you can see it queries the wrong URL :
https://{url}/jobs/j28ccad931fd54ea4aa35bb2a5d525bc8/results/j28ccad931fd54ea4aa35bb2a5d525bc8?f=json
It actually uses the jobId twice.
 
For the moment my workaround is to ignore the typing, and only pass the resultName
 

 

const output = await (jobSubmitted as any).fetchResultData(resultName);

 

Which calls the correct endpoint..
0 Kudos
1 Reply
ReneRubalcava
Frequent Contributor

Yeah, this was an error in the doc and typings. Your workaround is correct. The doc will be updated in a couple of weeks. If there are enough typings updates, we'll do an update for npm, unsure at the moment.