Skip To Content

Generate Token

Description

This operation generates a token. The generated security token can be used by clients when working with the Administrator API.

Request parameters

ParameterDescription
username

The name of an administrative account for the site.

Example

username=user1
password

The credentials of the administrative account.

Example

password=testpassword
client

The client IP or HTTPS Referer to which the generated token will be bound.

Values: referer | ip | requestip

Note:

If the value is set as referer, the referer parameter must be specified. If the value is ip, the ip parameter must be specified. If the value is requestip, the IP address from where the request originated is used.

referer

The base URL of the web application that will invoke the Administrator API. This parameter must be specified if the value of client parameter is referer.

Example

referer=https://myserver/mywebapp
ip

(Optional, required if client is set to ip).

The IP address of the machine that will invoke the Administrator API.

Example

##.##.###.###
expiration

The time in minutes for which the token must be valid.

Example

expiration=90
f

The response format. The default response format is html.

Values: html | json | pjson

Example usage

Below is a sample POST request for generateToken:


POST /webadaptor/admin/generateToken HTTP/1.1
Host: machine.domain.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []

username=user1&password=testpassword&client=referer&referer=https://machine.domain.com&expiration=90&f=json

JSON Response syntax


{
  "token":"<token>",
  "expires": "<date>"
}

JSON Response example


{
  "token": "sakjfh97325437hskfsdfd_sdkjfsjf1283763339564921734sdfbdsj",
  "expires": "13472658353687"
}