I am able to create token from Generate Token operation on ArcGIS Portal Directory using IP Address of this request's origin parameter like enter image description here

but when I try to achive the token from URL like

I am getting this error message

{"error":{"code":405,"messageCode":"GWM_0005","message":"Method not supported.","details":[]}}

How can I fix this to get the token?


By typing the request parameter in the URL, you are using the HTTP GET method to obtain the token. ArcGIS REST API states that only HTTP POST method is allowed. So the server replies with an error.

To place the request using the HTTP Post method, You can build the request using your favorite HTTP client:

  • Build your HTML form
  • Using curl
  • Use Python (using requests library)
  • etc..

Here are an examples of using python.

import requests

resp = requests.post("https://map.geoca.com/portal/sharing/rest/generateToken?f=json", 
    data={"username":"mapAdmin", "password":"pass123", 

print json.dumps(resp.json()["token"])

Source: http://resources.arcgis.com/en/help/arcgis-rest-api/#/Generate_Token/02r3000000m5000000/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.