API

token

URI

http://supermapimanager:8390/imanager/cloud/security/tokens[.<format>]

Supported Methods

POST

Introduction

Gets Token according to account information.

Supported methods:

  • POST: Gets Token according to account information.

Supported representation format: JSON.

HTTP Request Method

An HTTP request is performed on the following URI. Here we take JSON output format for illustration, where supermapimanager is the server name.

http://supermapimanager:8390/imanager/cloud/security/tokens.json

POST Request

Gets Token according to account information.

Request Parameters

Following parameters should be passed in the request body whiling getting Token.

Name Type Definition
username String User name
password String Password

Response Structure

If the user name and the password input are correct, a string is returned directly, which is the Token with permissions of the user.

If the user name and the password input are incorrect, the code 401 will be returned.

Response Example

Implement the POST request on the tokens resource http://supermapimanager:8390/imanager/cloud/security/tokens.json, and pass parameters in the request body as shown below:

Request head

Host: supermapimanager:8390
Content-Type: application/json; charset=UTF-8
Referer: http://supermapimanager:8390/imanager/

Request body:

{
  "username": "admin",
  "password": "admin"
}

The returned content is as follows:

7ac687f1-51c3-46ad-8617-89d737d1ba0d

With Token, users do not need to log in when creating a GIS environment. The user can directly carry Token to access those resources that require permissions. Here we take creating a GIS server as an example.

While not logged in, implement the POST request on http://supermapimanager:8390/imanager/cloud/web/nodes/server.json and pass the token in the request head.

Host: supermapimanager:8390
Content-Type: application/json; charset=UTF-8
X-Auth-Token: 7ac687f1-51c3-46ad-8617-89d737d1ba0d
Referer: http://supermapimanager:8390/imanager/

Pass following parameters in the request body, as shown below:

{
  "nodeSpec": "MEDIUM",
  "nodeCount": 1,
  "nodeName": "iserver",
  "password": "",
  "description": "",
  "physicalMachineName": "admin"
}

The returned json format response is as follows:

{
  "isSucceed": true,
  "msg": "",
  "resultId": "684"
}