Skip To Content

Generate Admin Token

  • URL:https://<admin-url>/generateToken
  • Version Introduced:10.0

Description

Note:

At 10.1 and later, the generateToken operation is not supported by the REST API admin. Use the generateToken operation supported by the ArcGIS ServerAdmin 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, for example, https://<admin-url>/system/handlers/rest/cache/clear?token=<token>.

Request parameters

ParameterDetails
f

The response format. The default response format is html.

Values: html | json

username

The administrator's user name. This user must be a member of the ArcGIS Server administrators group.

password

The administrator's password.

client

The client IP or HTTP referrer 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 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

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=https://myserver/mywebapp

ip

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

The token expiration time in minutes. The default is 60 minutes. Tokens can be generated up to a maximum expiry of 1 year (525,600 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
}