Select to view content in your preferred language

Accessing secured services via the REST API

3395
2
07-21-2010 09:37 AM
BrandonHerrington
Occasional Contributor
I have been successfully using tokens to access secured map services for the Javascript API and I was hoping it was a similar approach for using the REST API directly, but it doesn't seem to be.  I want to do an export of a secured map service via the REST API, but I don't see any obvious way to provide either a token or a username/password combo.

I can access the service after providing the username and password in the Services Directory and perform the export by hand, but getting the direct URL working is where I'm running into trouble.

Any advice on how to do that?
0 Kudos
2 Replies
RaviNarayanan
Esri Contributor
1. generate a token using the getToken page for a specific IP address .
2. use the token with any request to REST by specifying the token as a query string parameter in the request as shown in the example below.

http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapSe...<tokenstring>
0 Kudos
BrandonHerrington
Occasional Contributor
Thanks, Ravi.  I was almost there, I just had the parameters mixed up.  I kept adding another ? without paying attention to the one already there after the export.  I guess it pays to read a little more closely. 😮
0 Kudos