keys


URI

<mycontent_uri>/services[.<format>]

Supported methods

GET,POST,PUT,DELETE,HEAD

Parent resource

myContent

Introduction

Keys is a resource that records the Key collection added by current user. After the SuperMap iPortal has been started, services registered or delegated by user will under protection. The authority shall be controlled meanwhile. Key is used for access protected service on iPortal.

Supported Methods:

Supported output formats: rjson, json, html, xml.

Resource hierarchy

HTTP request methods

Implement the HTTP request on the following URI, where supermapiportal is the server name, with rjson being the output format.

http://supermapiportal:8090/web/mycontent/keys.rjson

GET request

GET: Gets the Key collection added by current user.

Request parameter

If this parameter is not set, then the list of keys on the first page will be returned. If the parameter is set, the list of the keys specified by the user will be returned. The request parameters are included in URI.

Name Type Description
currentPage int Page number.
pageSize int Size of each page.

Response structure

Execute a GET request on the keys resource to return the list of keys added by current user. It includes the following fields:

Field Type Description
content List<KeyInfo> Page content.
currentPage int The current page number.
pageSize int The page size.
searchParameter SearchParameter The search parameter for the current page.
total int The total record number.
totalPage int The total number of pages.

Response example

The returned rjson format representation after implementing the GET request on the keys resource http://localhost:8090/web/mycontent/keys.rjson is as follows:

{

    "content": [

        {

            "key": "ukQceZ3yKtBGsZF6um5dSuho",

            "clientType": "SERVER",

            "id": 4,

            "limitation": "192.168.120.40",

            "name": "app",

            "serviceIds": "1,2",

            "userName": "admin"

        }

    ],

    "currentPage": 1,

    "pageSize": 10,

    "searchParameter": null,

    "total": 1,

    "totalPage": 1

}

POST request

POST: Adds a new Key.

Request parameter

Following arguments need to be passed in the request sent.

Name Type Description
name String Name of the key.
serviceIds String ID Arrays of the authorised services.
clientType ClientType These types of client are allowed to access services: WEB,MOBILE,SERVER.
limitation String Limited characters for service access, vary by cilent types. WEB: source site referer; MOBILE: mobile applicaton ID; SERVER Request: request source site IP.

Response structure

The structure of the response resource representation is as follows:

Field Type Description
succeed boolean Whether it's successful to modify the key.
error Httperror Error message. This field will not be created if the key has been modified successfully.

Response example

Implement a POST request on the keys resource: http://localhost:8090/web/mycontent/keys.rjson to add a new key. The request is as follows:

{

    "name": "app1",

    "serviceIds": [

        2

    ],

    "clientType": "SERVER",

    "limitation": "192.168.120.40"

}

The response result in rjson format returned is as follows:

{ "succeed": true}

PUT request

PUT: Modifies Key parameters.

Request parameter

Execute PUT request for keys resource. Parameters passed in the request body are as follows:

Name Type Description
id int ID of the key that need modification.
name String Name of the key.
serviceIds String ID Arrays of the authorised services.
clientType ClientType These types of client are allowed to access services: WEB,MOBILE,SERVER.
limitation String Limited characters for service access, vary by cilent types. WEB: source site referer; MOBILE: mobile applicaton ID; SERVER Request: request source site IP.

Response structure

The response result returned is as the following:

Field Type Description
succeed boolean Whether it's successful to modify the key.
error Httperror Error message. This field will not be created if the key has been modified successfully.

Response example

Implement a PUT request on the keys resource: http://localhost:8090/web/mycontent/keys.rjson to modify the parameters of the key and to add a ccessible service. The request body is as follows:

{

    "id": 5,

    "name": "app1",

    "serviceIds": [

        1,

        2

    ],

    "clientType": "SERVER",

    "limitation": "192.168.120.40"

}

The response result in rjson format returned is as follows:

{ "succeed": true}

DELETE request

Deletes specified Key, batch operation supported. Pass the ID arrays of keys to delete within url.

Response structure

The structure of the response resource representation is as follows:

Field Type Description
succeed boolean Whether it's successful to delete keys.
error Httperror Error information. This field wont be created if the keys have been deleted successfully.

Response example

Implement the DELETE request on the keys resource http://localhost:8090/web/mycontent/keys.rjson?ids=[4,5] to delete keys with ID 4 and 5. Return rjson results:

{ "succeed": true}

HEAD request

Asks for the response identical to the one that would correspond to a GET request, but without the response body. This is useful for retrieving meta-information written in response headers, without having to transport the entire content. The meta-information includes the media-type, content-encoding, transfer-encoding, content-length, etc.

HEAD request can be used to check whether the keys resource exists, or whether the the client has the permission to access it. It can also determine if the keys resource supports an output format <format> if performed on a URI with .<format> included.

See