|
POST
|
We are writing a REST application to access AGS map services. We cannot use the ArcGIS JSAPI - everything I do can only use REST verbs (GET, PUT, etc.) • We want to access secure map services that are hosted on-premise on ArcGIS Server • We have on-premise Portal for ArcGIS Server • ArcGIS Server security (User Store, Role Store, Authentication Tier, and Authentication Mode) uses Portal for ArcGIS To get an Oauth2.0 token I can use this URL: https://<DOMAIN>/portal/sharing/rest/oauth2/token?grant_type=client_credentials&client_id=<CLIENT_ID>&client_secret=<CLIENT_SECRET> Which returns a JSON payload like this: {"access_token":"fCsz6hbXOsnjfIt1j30HAofVMcu3xEhnsgao2rq4_98xOAlf72oR17LYvj1gydJ7ZYnhzxzU4G-vBWNW_0thHQqSYt-HDuzVenv-v6nws1xkGu6XOI3peobXFobZo5QV6NcglZYF6YiFbMM8MPdE7A..","expires_in":7200} To get an old-fashioned REST token I can use this URL: https://<DOMAIN>/portal/sharing/generateToken?f=json&username=<USERNAME>&password=<PASSWORD>&clientip=requestip Which returns a JSON payload like this: {"token" : "KfD9KGedbu2lDrBc2umSVv08XDFCsU8HuKU0yBiFoFk375ahReXmcfVBbsGbGr1iotf003H319dG35T-7Q5-c933dWD0dfLPaflTu4QucS4jJ2Zcz0oIprFspEzk78tHky0IeuHswBudKDbebOQISQ..","expires" : 1453833598866,"ssl" : true} I want to access: https://<DOMAIN>arcgis/rest/services/SampleWorldCities/MapServer?f=json In the pre-Portal for ArcGIS days of REST I could use a URL: https://<DOMAIN>arcgis/rest/services/SampleWorldCities/MapServer?f=json&token=<SOMETOKEN> where <SOMETOKEN> was obtained from the REST token dispenser. HOWEVER: neither of the tokens I’ve obtained from the Portal dispenser nor the REST dispenser work. Both return: {"error":{"code":498,"message":"Invalid Token","details":[]}} THE QUESTIONS: • Which token dispenser do I use? • How do I string together a URL that uses a token I have obtain (from the correct source) then I can use to access our secured services? TIA
... View more
01-26-2016
09:29 AM
|
2
|
10
|
15672
|
|
POST
|
For a variety of reasons, we'd like to host our webmaps on-premise using Portal for ArcGIS Server instead of ArcGIS Online. That means the content of the webmap has to be consumable by a JSAPI application by its JSON. Also exposed is its webmap ID. esri/arcgis/utils | API Reference | ArcGIS API for JavaScript indicates that createMap can use an itemID (if hosted at AGOL) or itemData - which will be the JSON that can be embedded in the application - e.g., in a configuration. We have a highly customized JSAPI application - its functionality cannot be recreated using the WAB or any of the templates. Our problem is that our webmaps change quite frequently - it's impractical to export the webmap into JSON and put the JSON into a configuration every time the webmap changes. At the same time, the JSAPI application can only use createMap with an itemID if the webmap is hosted at AGOL. Is there some special magic I can use to consume a locally-host webmap by its itemID? For example, if I knew the URL of the webmap, can I tease the configuration JSON out of it and use that to hydrate the map in the JSAPI app? Just an idea... Discuss... BTW JSAPI 3.x and we won't refactor a release in 4.x until it's been in production for at least a year. TIA
... View more
12-02-2015
11:02 AM
|
0
|
0
|
2491
|
|
POST
|
Close but not quite there yet. Turns out that unset is not supported in IE, Safari, and Opera. unset - CSS | MDN
... View more
10-09-2015
08:26 PM
|
1
|
1
|
1708
|
|
POST
|
I've got a map dijit - by default the simple zoom slider (+/-) is in the upper left corner. I want to place it in the upper right corner. According to the documentation I can use this in my CSS: .esriSimpleSliderTL { top: 50px; right: 50px } Unfortunately all this does is stretch the zoom slider. Like this: Try it here: http://jsfiddle.net/bEwcD/3/ How to I get that zoom slider 50px by 50px from the upper right? TIA
... View more
10-08-2015
08:41 PM
|
0
|
3
|
3949
|
|
POST
|
We we all know, if you have a web map app that consumes secure services, when you navigate to that page the IdentityManager will provide a login dijit which creates a security. I have a web page named MyWebAppWithSecureServices.html that meets that criteria. I want my users to log in from another html page (MyLoginPage.html) and use that security to do a window.location.replace("MyWebAppWithSecureServices.html"); I want to do this without having to do any magic with a token, like appending it to the URL of a service REST endpoint. I know I need to use "esri/Credential", "esri/IdentityManager", "esri/ServerInfo" to accomplish my goal. I'm having no success. Can you help me wrap my head around this please? TIA In the code below esriId is an instance of "esri/IdentityManager" function tryCreateCredentialsAndRedirectToAppWithSecureServices() {
var userId = dojo.byId("username").value;
var password = dojo.byId("password").value;
var serverInfo = new ServerInfo();
serverInfo.server = "http://www.MyDomain.com";
serverInfo.tokenServiceUrl = "http://www.MyDomain.com/ArcGIS/tokens/";
esriId.registerServers([serverInfo]);
esriId.generateToken(serverInfo, {
username: userId,
password: password
}).then(function(response) {
// got our response from the token dispenser, now register it with the identify manager
var tokenRegistrationObject = {
expires: response.expires,
server: serverInfo.server,
ssl: false,
token: response.token,
userId: userId
}
esriId.registerToken(tokenRegistrationObject);
var myCred = esriId.findCredential( "http://www.MyDomain.com", userId);
var idObject = {};
idObject.serverInfos = serverInfo;
var credentials = {};
credentials.userId = userId;
credentials.server = "http://www.MyDomain.com/arcgis";
credentials.token = response.token;
credentials.expires = response.expires;
credentials.ssl = false;
credentials.scope = "server";
credentials.validity = response.validity;
credentials.creationTime = myCred.creationTime;
idObject.credentials = [credentials];
esri.id.tokenValidity = response.validity;;
esri.id.initialize(idObject);
window.location.replace("MyWebAppWithSecureServices.html");
});
}
... View more
07-28-2015
11:08 AM
|
0
|
0
|
2310
|
|
POST
|
Oops, a thousand pardons, I should have been more specific. The searched webmap is hosted at AGOL. The JSON data creating the searchable layers is show below. That being said, I can interrogate said JSON to build my search sources using the snippet you provided (which I think is also a JSAPI sample). Nonetheless, I didn't make the connection until your post. Thx "search": { "enabled": false, "disablePlaceFinder": true, "hintText": "Find Asset", "layers": [{ "id": "AnOutageStatus_9360", "field": { "name": "A_FIELD_NAME", "exactMatch": false, "type": "esriFieldTypeString" } }, { "id": "AnOutageStatus_3600", "field": { "name": "A_FIELD_NAME", "exactMatch": false, "type": "esriFieldTypeString" } }, { "id": "AnOutageContext_2098", "field": { "name": "A_FIELD_NAME", "exactMatch": false, "type": "esriFieldTypeString" }, "subLayer": 1 }, { "id": "AnOutageContext_2098", "field": { "name": "A_FIELD_NAME", "exactMatch": false, "type": "esriFieldTypeString" }, "subLayer": 0 }] }
... View more
07-23-2015
12:03 PM
|
0
|
0
|
943
|
|
POST
|
The attached picture shows the search option I want to remove so the search options are just my local sources (below the Esri World Geocoder). TIA
... View more
07-23-2015
11:14 AM
|
0
|
2
|
3727
|
|
POST
|
Yep --> z-index. In fact, all I needed to do was set a z-index for the timeSlider in css and the problem disappeared. Didn't even matter what the z-index was. Thanks Kelly and Owen
... View more
06-10-2015
08:10 AM
|
1
|
0
|
1549
|
|
POST
|
My JSAPI web app has a timeslider on it. There is also a dijit.forms.button that is used to open a dijit.dialog, which will have content. When the dijit.dialog is shown, the time slider stays visually on top of the dijit, dialog. I've testing it in a couple of scenarios and this is repeatable. I've done with both declarative and programmatic instances of the time slider and dijit.dialog. The screen caps below show what's going on. Before the OpenDialog button is clicked, the UI looks like this: After the OpenDialog button is clicked, the UI looks like this: Note how the play button, slider and thumbs, and FF/RW buttons are staying on top of the "Outage Schedule" dijit.dialog. Also, the mouse events still occur on the time slider, instead of being "greyed out" like the rest of the application. Seriously, what's up with that? Is this a defect in the JSAPI TimeSlider widget? Is that a way to put the time slider "under" the modal dialog? Any help please. TIA Dirk
... View more
06-09-2015
01:09 PM
|
0
|
3
|
4489
|
|
POST
|
I want to hide the ticks on my time slider, there are so many of them (monthly form 2011 to 2020 - in-progress development will bind the timeSlider to some DateTextBox dijits) How do I style the slider to not display the ticks. I'm using claro.css TIA something like: this.timeSlider = new TimeSlider({ style:HIDE_THE_TICKS}, domConstruct.create("divTimeSlider", {}, timeDiv));
... View more
02-20-2015
04:11 PM
|
0
|
0
|
4043
|
|
POST
|
I have a FeatureLayer in my map. I want to query the FeatureLayer and display the results in a esri.dijit.FeatureTable (ie., a subset of the graphics in the FeatureLayer need to be used to populate the FeatureTable). Those are the requirements. Simple, right. What am I missing??? Querying the FeatureLayer directly returns a TypeError: cyclic object value so I can't even create the FeatureLayer to hydrate the FeatureTable with. The code: var myQuery = new Query(); myQuery.returnGeometry = true; myQuery.where = "1=1"; myFeatureLayer.queryFeatures(myQuery,function(queryResults) { var layerDefinition = { "geometryType": queryResults.geometryType, "fields": queryResults.fields }; var layerDefinition = { "geometryType": queryResults.geometryType, "fields": queryResults.fields }; var featureCollection = { layerDefinition: layerDefinition, "featureSet": { "features": queryResults.features, "geometryType": queryResults.geometryType } }; var featureLayer = new FeatureLayer(featureCollection, { mode: esri.layers.FeatureLayer.MODE_SNAPSHOT }); alert("GOT FSET"); }); Using a QueryTask with the url of the FeatureLayer (thus creating round-trips to the server) doesn't work either and errors with Error: FeatureLayer::_query - query contains one or more unsupported parameters: var queryTask = new QueryTask(myFeatureLayer.url); var query = new Query(); query.where = "1=1"; queryTask.execute(query, function(queryResults) { var layerDefinition = { "geometryType": queryResults.geometryType, "fields": queryResults.fields }; var layerDefinition = { "geometryType": queryResults.geometryType, "fields": queryResults.fields }; var featureCollection = { layerDefinition: layerDefinition, "featureSet": { "features": queryResults.features, "geometryType": queryResults.geometryType } }; var featureLayer = new FeatureLayer(featureCollection, { mode: esri.layers.FeatureLayer.MODE_SNAPSHOT }); myTable = new FeatureTable({ "featureLayer" : featureLayer, "map" : map }, 'myTableNode'); myTable.startup(); alert("GOT queryResults"); }); And yes, I know the FeatureTable is in beta at 3.12. And yes, I can already do this in Silverlight and Flex.
... View more
01-29-2015
09:48 AM
|
0
|
3
|
6108
|
|
POST
|
I'm struggling to generate a security token from my on-premise token server. The SDK's documentation is not obvious. My code is: var si = new esri.ServerInfo(); si.tokenServiceUrl = "http://www.MyTokenDispenser.com/ArcGIS/tokens/"; var imb = new esri.IdentityManagerBase(); imb.on("credential-create", createdCredential); imb.generateToken({ serverInfo:si, userInfo:{userName:"MyUserName", password:"MyPassword"} }); I want to catch the token in the createdCredential method. This code throws an error in the JSAPI API: TypeError: r is undefined http://js.arcgis.com/3.12/ Line 663 We do not want to use the out-of-the-box login that comes with esri.IdentityManager, instead we want to generate our own tokens and credentials. I can use query GET to get a token and I can use esri.request to get a token so long as I enable a proxy, but the code is a bit messy and defeats the purpose of the ArcGIS JSAPI. TIA for any guidance you can offer.
... View more
12-26-2014
10:30 AM
|
0
|
1
|
4331
|
|
POST
|
...similar to ArcView, ArcGIS Desktop, ArcPad, and just about everything else Arc? Extensions, custom tools and UX, all that good stuff. Or is the plan to keep it closed and force the workflow around the Collector way of doing things? Just asking...
... View more
08-26-2014
11:32 AM
|
0
|
0
|
3279
|
|
POST
|
Greetings: I am working on a mission-critical application that will undergo brief periods of terror. Based on "things happening", there may suddenly be a few 10's of thousands making map requests in a brief interval of time (many minutes to a couple of hours). My client wants to know how an AGOL web map can handle that kind of stress. Rather than writing my own stress test, are there any folks here that have experience with commercial site stressors. I am most interested in how the map responds - the web map will be embedded in another web application hosted elsewhere. I know there are commercial offerings like Blitz, LoadImpact, SiteLoadTesting, and others, but these see more focused on stressing more tradition web applications. So, does anyone here have any experience and sage buts of wisdom on how to stress test an AGOL web map? TIA
... View more
07-01-2014
08:50 AM
|
0
|
0
|
3140
|
|
POST
|
Greetings: I am working on a mission-critical application that will undergo brief periods of terror. Based on "things happening", there may suddenly be a few 10's of thousands making map requests in a brief interval of time (many minutes to a couple of hours). My client wants to know how an AGOL web map can handle that kind of stress. Rather than writing my own stress test, are there any folks here that have experience with commercial site stressors. I am most interested in how the map responds - the web map will be embedded in another web application hosted elsewhere. I know there are commercial offerings like Blitz, LoadImpact, SiteLoadTesting, and others, but these see more focused on stressing more tradition web applications. So, does anyone here have any experience and sage buts of wisdom on how to stress test an AGOL web map? TIA
... View more
07-01-2014
08:49 AM
|
0
|
1
|
1026
|
| Title | Kudos | Posted |
|---|---|---|
| 5 | 11-10-2021 12:27 PM | |
| 1 | 10-02-2019 10:47 AM | |
| 1 | 09-24-2021 08:40 AM | |
| 1 | 09-28-2018 10:16 PM | |
| 1 | 10-09-2015 08:26 PM |
| Online Status |
Offline
|
| Date Last Visited |
05-05-2023
03:51 AM
|