Secured Services information at REST end

3672
1
05-14-2015 11:56 PM
ShikharDeep1
New Contributor

How to determine if  any gis service is secured or unsecured at the REST end point. I want to hit the arcgis server REST using Python and find if services are secured or not.

0 Kudos
1 Reply
JaiSiva1
New Contributor III

Hi Shikhar,

Case 1:

If the services that you are accessing are known to you , you will probably know the services that are published.

So , you can query them using urllib/ urllib2 like :

import urllib2
url = "http://YourUrl/rest/services/sample/MapServer/0/query?where=1%3D1&f=pjson"
data = urllib2.urlopen(url).read()
print data

If you are getting results , then it is not secured.

If you are getting result as  '{\n "error": {\n  "code": 499,\n  "message": "Token Required",\n  "details": []\n }\n}' , or any such error , then it is secured.

Case 2:

If the services that you are accessing is not known to you and you can do a simple analysis using the following URL: http://YourURL/rest/services/?f=pjson

and conclude if the services are secure or not secure.