GIS Cloud Suite

tokens

URI

http://{server}:{port}/manager/web/api/tokens

Supported Method

POST

Introduction

Get the token according to the account. Users can not access GIS Cloud Suite without token.

Supported Interchange Format: JSON.

HTTP Request Method

Execute HTTP request to the URI below. In the URI below, {server} is the server of gateway, replace it by the actual gateway IP. {port} is the port of gateway, replace it by the actual gateway port.

http://{server}:{port}/manager/web/api/tokens

Post Request

Users get tokens

Headers Format

content-type: application/json

Request Params

Transmit the following parameters in the body when getting token:

Name Type Expalination
userName String Account username
password String Account password

Response Structure

Name Explanation
access_token The token for access
refresh_token Used for refresh the token when the token is expired
refresh_expires_in The expired time of the refresh_token
token_type The type of token
expires_in The expired time of the access_token

Response Case

Execute POST request for token resource. URL http://192.168.17.139:32507/manager/web/api/tokens:

Headers:

content-type: application/json

Body:

{
  "userName":"user_admin",
  "password":"iserver"
}

Returned response:

{
    "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJNRnpGNG9lalI2ZGJiR2xVZWYtUi1xa1M0RWF4TThJU1lOTkpNc1dROTVFIn0.eyJqdGkiOiI1ZTI3MjFmNi1iMGI1LTQ2MzYtOGRlZi1kYTE2NzEzOWVjZWYiLCJleHAiOjE1NTcxMDQyODEsIm5iZiI6MCwiaWF0IjoxNTU3MTAzOTgxLCJpc3MiOiJodHRwOi8vMTkyLjE2OC4xNy4xMzk6MzI1NDEvYXV0aC9yZWFsbXMvaXNwZWNvIiwiYXVkIjoiaXNwZWNvLWRhc2hib2FyZC1hcGkiLCJzdWIiOiJhMDk4ZTNiZS1iZGMwLTQ4ODQtOTk2NC04MWZlMjVjNTE3MmYiLCJ0eXAiOiJCZWFyZXIiLCJhenAiOiJpc3BlY28tZGFzaGJvYXJkLWFwaSIsImF1dGhfdGltZSI6MCwic2Vzc2lvbl9zdGF0ZSI6ImYzNzZkZjcxLTgwOWEtNDYwOS1hOWZmLWZjZGU0NmRhNDAzYiIsImFjciI6IjEiLCJhbGxvd2VkLW9yaWdpbn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hMDk4ZTNiZS1iZGMwLTQ4ODQtOTk2NC04MWZlMjVjNTE3MmYiLCJ0eXAiOiJSZWZyZXNoIiwiYXpwIjoiaXNwZWNvLWRhc2hib2FyZC1hcGkiLCJhdXRoX3RpbWUiOjAsInNlc3Npb25fc3RhdGUiOiJmMzc2ZGY3MS04MDlhLTQ2MDktYTlmZi1mY2RlNDZkYTQwM2IiLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsiYnVpbHRpbiIsIm9mZmxpbmVfYWNjZXNzIiwiQURNSU4iLCJ1bWFfYXV0aG9yaXphdGlvbiJdfSwicmVzb3VyY2VfYWNjZXNzIjp7ImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJtYW5hZ2UtYWNjb3VudC1saW5rcyIsInZpZXctcHJvZmlsZSJdfX0sInNjb3BlIjoiZW1haWwgcHJvZmlsZSJ9.vZRLjw4XaThk1i573zInoGLdJdtHGbCUxAyYu0n8uOU",
    "refresh_expires_in": 1800,
    "not-before-policy": 0,
    "scope": "email profile",
    "token_type": "bearer",
    "session_state": "f376df71-809a-4609-a9ff-fcde46da403b",
    "expires_in": 300
}

If the returned response you get was same as the example, you have got the token successfully, the token is the content in ‘access_token’. You can use the token to visit GIS Cloud Suite.

How to use token

After getting the access_token by POST request, execute the resource request, take http://{server}:{port}/manager/web/api/service/nodes as an example. There are three methods to achieve resource request, they are Authroization Header, Form-Encoded Body Parameter, and URI Query Parameter. The three methods decrement by priority.

Notes:
The expiration time of access_token is 5 minutes. If the token was expired, used refresh_token to get the new token(the expiration time of refresh_token is 30 minutes), or reacquire the access_token.

Authorization Header

The format of Headers:

GET resource HTTP/1.1

content-type: application/json
Authorization: Bearer {access_tokens}

Example:

GET http://192.168.17.139:32507/manager/web/api/service/nodes

content-type: application/json
authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJNRnpGNG9lalI2ZGJiR2xVZWYtUi1xa1M0RWF4TThJU1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OXe3zjCnx7e0tisMX7eYGn0x6sBstmqIYDDnJ9bodyGFOYoMFrA4xrOtOufuJ3uiIxtkJOGmGuDm2w_UhswgY67Yn5NqPi-gtzEYd0c2NcoIWSfX5db0zEuKYepeqE4s_HcQRAAX_ZJy9eg

The returned response in json format:

[
    {
      "nodeName": "Node",
      "nodeType": null,
      "featureIds": null,
      "instanceNumber": 0,
      "serviceInfos": [
        {
          "componentName": "map-China400-d3awywrtby",
          "interfaceName": "rest",
          "name": "Instance-map-China400-d3awywrtby-rest",
          "providerName": "Provider-map-China400-d3awywrtby",
          "dataSourceType": "workspace",
          "serviceType": "map-rest"
        }
      ],
      "available": true
    }
]

Form-Encoded Body Parameter

Use this method when the client does not support the method Authorization Header.

The format of Headers:

POST {resource} HTTP/1.1

content-type: application/x-www-form-urlencoded

The format of Body:

access_token={access_token}

Notes:
Form-Encoded Body Parameter does not support GET request, the request body must follow the application/x-www-form-urlencoded coding, separate the parameters by symbol ’&‘.

URI Query Parameter

Use this method when both of Authorization Header and Form-Encoded Body Parameter could not request.

The format of Headers:

GET {resource}?access_token={access_token} HTTP/1.1

Cache-Control: no-store

Example:

Get http://192.168.17.139:32507/manager/web/api/service/nodes?access_token=eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJNRnpGNG9lalI2ZGJiR2xVZWYtUi1xa1M0RWF4TThJU1lOTkpNc1dROTVFIn0.eyJqdGkiOiI1ZTI3MjFmNi1iMGI1LTQ2MzYtOGRlZi1kYTE2NzEzOWVjZWYiLCJleHAiOjE1NTcxMDQyODEsIm5iZiI6MCwiaWF0IjoxNTU3MTAzOTgxLCJpc3MiOiJodHRwOi8vMTkyLjE2OC4xNy4xMzk6MzI1NDEvYXV0aC9yZWFsbXMvaXNwZWNvIiwiYXVkIjoiaXNwZWNvLWRhc2hib2FyZC1hcGkiLCJzdWIiOiJhMDk4ZTNiZS1iZGMwLTQ4ODQtOTk2NC04MWZlMjVjNTE3MmYiLCJ0eXAiOiJCZWFyZXIiLCJhenAiOiJpc3BlY28tZGFzaGJvYXJkLWFwaSIsImF1dGhfdGltZSI6MCwic2Vzc2lvbl9zdGF0ZSI6ImYzNzZkZjcxLTgwOWEtNDYwOS1hOWZmLWZjZGU0NmRhNDAzYiIsImFjciI6IjEiLCJhbGxvd2VkLW9yaWdpbnMiOlsiKiJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsiYnVpbHRpbiIsIm9mZmxpbmVfYWNjZXNzIiwiQURNSU4iLCJ1bWFfYXV0aG9yaXphdGlvbiJdfSwicmVzb3VyY2VfYWNjZXNzIjp7ImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJtYW5hZ2UtYWNjb3VudC1saW5rcyIsInZpZXctcHJvZmlsZSJdfX0sInNjb3BlIjoiZW1haWwgcHJvZmlsZSIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwicHJlZmVycmVkX3VzZXJuYW1lIjoidXNlcl9hZG1pbiJ9.YWcFA4zQQMCCE_CO8qPWpRgzB1zhrFKJ5flC2mwBDJg_pJxkuye2Hd5JvxtsZwRqYcqb5ox33h2JF_kTHjIx1YmwyItOIR1Q13otUqXa3nltYCp3ixoHeC9vfNu0Dnqi55rteNnHD3ILKgaJBJLxS7n4FrZzHODHjnb4rJT6rCGt8DFRFyVE5Ibah2DX7Yo4k2vXPohOXe3zjCnx7e0tisMX7eYGn0x6sBstmqIYDDnJ9bodyGFOYoMFrA4xrOtOufuJ3uiIxtkJOGmGuDm2w_UhswgY67Yn5NqPi-gtzEYd0c2NcoIWSfX5db0zEuKYepeqE4s_HcQRAAX_ZJy9eg

Cache-Control: no-store

The returned rensponse in json format:

[
    {
      "nodeName": "Node",
      "nodeType": null,
      "featureIds": null,
      "instanceNumber": 0,
      "serviceInfos": [
        {
          "componentName": "map-China400-d3awywrtby",
          "interfaceName": "rest",
          "name": "Instance-map-China400-d3awywrtby-rest",
          "providerName": "Provider-map-China400-d3awywrtby",
          "dataSourceType": "workspace",
          "serviceType": "map-rest"
        }
      ],
      "available": true
    }
]