(executive summary: I'm looking for working samples of how to (oauth2-)authenticate 10.2.3-OnlineRouteTask to work with online routing services; additionally what the correct URLs of those are.)
Actually, the oauth2 part is the only thing not causing me problems..? It's the issue of how to pass that info on to ESRI/OnlineRouteTask in a way that works?
I can correctly get an access_token from https://www.arcgis.com/sharing/rest/oauth2/token/ with QNetworkRequest. But I don't know how to instantiate ER::OnlineRouteTask with this info?
(note: my code succeeds in getting an online route, if I use the public sampleserver6.arcgisonline.com service without authentication.)
OnlineRouteTask accepts an ER::UserCredentials argument, but UC requires a 'referer', which I don't know what is? The docs for 'UserCredentials' are quite unclear, but suggest it would contact the oauth server itself? (ie so I can't init it with data I've procured?) (I also don't know, if it's for oauth1.0 or oauth2.0?) The only 'docs' I've found are https: //developers.arcgis.com/qt/cpp/api-reference/class_esri_runtime_qt_1_1_user_credentials.html
The whole thing is worsened by, that none of it gives proper error messages; instead, the 3 kinds of "responses" I get from ArcGisRuntime are (1) whole map square turns blue? (this seems to happen if you attempt to configure a RouteTask wrongly?) (2) "routetask.solve" is started silently, but nothing ever returns, neither success nor failure. (3) some spurious stack trace crash in some "validateLicenseEsriforEmail??".
Also, I can't figure out which URL to actually use for online routing? The ones I suspect to be correct, reply with "directory listing has been disabled for this item" if I try to access them from a browser?
(NB! Links have typos on purpose, to allow stackexchange to post them.) e.g. hztp_ //route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World
(I'm using 10.2.3, because porting to 10.2.6 require more changes to our code base than we have time for in our app release timeframe, e.g. 'graphicIds' changed from sync to async. I have already ported our code to 10.2.6 (in a separate branch), which taught me that it will take us a long time to fully port to 10.2.6 (ie where all features are working again.)
My outset is the ArcGIS Runtime-SDK-for-Qt samples, specifically the "Routing(Online)" sample.
However, it makes no hint at how to authenticate, and it uses demo server http_ //sampleserver6.arcgisonline.com/arcgis/rest/services/NetworkAnalysis/SanDiego/NAServer/Route (also, I see the same example in 10.2.6 demos?)
Some URL's I've found are http_ //logistics.arcgis.com/arcgis/rest/services/World/Route/GPServer/FindRoutes (but can this be used for Qt, or this intended for other sdk's? How does one find this out?)
This is the one I suspect is the right one to use: http_//route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World but probably it should be https' - https_//route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World
However, if I try it, I don't get any errors.. I just never get any response from '.solve()' :-(.
Currently, my code looks like this:
QString token, ref; token = EgisProj2::access_token; ref = "https://www.arcgis.com/sharing/rest/oauth2/token/"; ER::UserCredentials creds; creds.setUserToken(token, ref);
m_routingTask = ER::OnlineRouteTask(actualURL, creds);
which, when used with "https_//route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World", yields.. nada.. no error msg, no reply.
I'm finding I'm almost spending more time trying to resolve the authentication aspects of the app, than I'm spending doing business logic app development with ESRI for my companies' actual domain - not exactly what I was hoping for in a productivity library :-(.
What puzzles me the most, is that I get no hits when googling any of this - it feels as if I'm the last man on earth still using Qt. Which I don't quite understand, because it's a wonderful library.
ADDITIONAL INFO: Actually, one of the assumed URL's I've found for the online routing service, from googling and older examples, is this one:
however, trying to use it with Esri 10.2.3, I just get this error:
'There was an error solving the route. Unable to complete operation. 'attributeParameterValues' parameter is invalid'
Given that the same service can be easily used 'by hand' (ie by just filling out the REST arguments by hand), this error suggests that arcgis-10.2.3 is somehow filling out the request parameters wrongly.. And I can't figure out, what I can control/change, that would affect 'invalid attributeParameterValues'.
My impression is that 'http_//tasks.arcgisonline.com' is just an older demo version of the API that is not currently relevant. To me, I thought it might help to figure out how to authenticate this service my company is paying for the allegedly privilege of accessing :-)
THIRD ADDITIONAL INFO: Further: based on current web docs, this is (approx..) the URL I assume to be correct for async online routing:
https_//logistics.arcgis.com/arcgis/rest/services/World/Route/GPServer/FindRoutes // submitJob?parameters");
(here I assume that the 'submitJob/parameters' part will be handled by arcGisRuntime..?)
based on this link: ArcGIS REST API - Route servicewith asynchronous execution http_ //resources.arcgis.com/en/help/arcgis-rest-api/02r3/02r300000275000000.htm
But using that doesn't give any result, not even an error.