How to Pass Tokens into Geocoder Tool
I am wondering what the best way is to pass a token into an external geocoder URL through the workflow geocode tool? For example, the URL is "https://api.mapbox.com/geocoding/v5/mapbox.places/{Address query}.json?access_token={token}".
Is it possible to use external geocoders, or do I have to reference the ArcGIS Online or Portal versions?
-
Hello Roger,
It should be possible to create and use a token using the Get Layer and Parse URL activities. Take a look the the GW5 - Secured Query workflow (https://latitudegeo.maps.arcgis.com/home/item.html?id=9f04c0a951a542d3b2812f69b3d741b4). Using the ID of the layer on your site, you can parse this layer's URL, then append it to the Url that the Geocoder uses: ="http://ServerName/arcgis/rest/services/Locators/SanDiego/GeocodeServer?token=" + $parseurl1.query["token"] .
It is also possible to obtain the token of a layer not currently on the map by using the Send Web Request activity.
Thanks, Stefan
0 -
?Hi Stefan,
I'm not able to access that example workflow. Is it still online and public facing?
Thanks
0 -
Got this figured out. You can disregard. Thx.?
0 -
Well, I spoke too soon. I'm using the approach described above. In my case its with a secured feature service, and trying to create a feature. I get an error with the message 'No token available for service https://<server>/cobgis/rest/services/COB_Utilities/<service>/FeatureServer/2/applyEdits?token=SKkkk6-tGg80iHMsYUl9iSqQAA99NDrfmBUkmkUpAUjWEh1QAAywUWUHYCfWDU8tK6xnQXa4mJ".
Looks like should be valid request. Any ideas what may be wrong?
Thanks
0 -
Hello Zorba,
Would you be able to provide your workflow so that I can take a look? The request also looks valid to me and adding features to a secured service is supported.
Thanks, Stefan
0 -
Stefan,
I just sent you an email with the WF attached. Thanks.?
0 -
Hi Zorba, just throwing in my 2 cents here; I'm not familiar with Mapbox geocoders, but the geocoding activities would have been designed for use with ArcGIS geocoding services. If the Mapbox geocoder uses a different format (different inputs/url format/outputs) than an ArcGIS (server/portal/online) geocoder, we'll probably run into issues.
Either the request that the workflow sends to the geocoder won't be valid for it, or the response from the geocoder won't map up to what the activity uses to create its outputs from it. You could check the former by watching the web requests sent by the workflow to the geocoder in Fiddler or your browser tools (F12) network tab. If that's the case, we might be able to use a Send Web Request activity instead to create the web request in the correct format for the geocoder.
0 -
So, I’m actually not dealing with a geocoder. I added my question to this thread, because there was a discussion of a generic approach to getting a token and passing it to a service. In my case, it’s just a feature service which I’m trying to add a feature to. I guess it would have been clearer if I just started a new thread. Upshot is that I’m getting the token, but for whatever reason it’s not being seen as valid. Any thoughts?
Thanks
0 -
Hi Zorba,
My bad, I should have addressed my answer to Roger. Somehow I managed to mistake you as the original poster.
Is the token invalid, or the request in general? It's possible that the applyEdits request is failing for some other reason. You could log or alert the same value that you're using for Query Layer's Url, and check that url in an incognito window to see if the token works.
You could also watch your network traffic (network tab in F12 tools), and find the applyEdits request. Sometimes you can get clues there as to why a request to ArcGIS Server is failing.
0 -
@Zorba Conlen? were you able to get this figured out? I'm getting the same "No token available for service..." error. Thanks!
0 -
Hi Tara,
No, I had to go live with an unsecured service, which is not great. I think there was an issue with the version of WF5, in addition to the above, which was related to attachments for secured services. The secured service could not handle attachments, and that was supposed to be fixed in an upcoming release, so I put this on hold for the time.
What is your requirement? Are you creating or editing features? I need to revisit this, and if I figure it out, will reply here. Let me know if you come up with solution.
Thanks
0 -
Thanks for the response @Zorba Conlen?. Our users will use this workflow to edit features. We are about to go live with an unsecured feature service as well... definitely less than ideal. I just can't figure out what might be going on here. Thanks for your willingness to share if you are able to find success!
0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
12 commentaires