Generate Admin Token

Description

NoteNote:

At 10.1 and later, the generateToken operation is not supported by the REST API admin. Use the generateToken operation supported by the ArcGIS Server Admin API instead.

The Generate Admin Token operation generates a security token that can be used by clients when working with the Admin API. The ArcGIS Server Administrator is secured so that only users that have ADMINISTER or PUBLISH privileges have permissions to access the admin.

The token generated by this operation needs to be specified using the token parameter when accessing the Admin. Example: http://<admin-url>/system/handlers/rest/cache/clear?token=<token>

Request parameters

Parameter

Details

f

Description: The response format. The default response format is html.

Values: html | json

username

Description: The admin username. This user must be a member of the ArcGIS Server administrators group.

password

Description: The admin password.

client

Description: The client IP or HTTP referer for which the token is to be generated.

  • If the value is specified as ip, the ip parameter must be specified.
  • If the value is specified as requestip (request IP), the token is generated for the IP from where the request originated.
  • If the value is specified as referer, the referer parameter must be specified.

The default value is referer.

Values: referer | ip | requestip

referer

Description: The base URL of the web app that will invoke the Admin API. This parameter must be specified if the value of the client parameter is referer.

Example: referer=http://myserver/mywebapp

ip

Description: The IP address of the machine that will invoke the Admin API. This parameter must be specified if the value of the client parameter is ip.

Example: ip=###.###.###.###

expiration

Description: The token expiration time in minutes. The default is 60 minutes. Tokens can be generated up to a maximum expiry of 1 year (525600 minutes).

Example: expiration=43200 (1 month)

JSON response syntax

{
  "token": "<token>",
  "expires": <expires> //the time (in milliseconds from epoch) when this token will expire
}

JSON response example

{
  "token": "G6943LMReKj_kqdAVrAiPbpRloAfE1fqp0eVAJ-IChQcV-kv3gW-gBAzWztBEdFY",
  "expires": 1255466350163
}

10/6/2017