VERSION API REST API LIST API

TOKEN API

This page describes the K2HR3 TOKEN API. The purpose of the TOKEN API is to create a token and show details for a token and validate a token. A token is a string generated for authorization to permit access to a K2HR3 environment. The K2HR3 REST APIs accept both a request with a token and a tokenless request to restricted resources. As of a request with a token, clients must send each request with a token in the right place correctly, so that the K2HR3 REST APIs can identify the type of a request. See the each API page for details.

POST

Unscoped user token

Creates an unscoped user token, which is a token without an explicit scope of authorization. Credentials are required. See the information below for request parameters.
When cooperated with OpenStack, unscoped user token can be generated by specifying unscoped token (id) or scoped token (id) issued by OpenStack(Identity).

Scoped user token

Creates a scoped user token, which is a token scoped to a tenant(or project). Credentials or unscoped user token is required. See the information below for request parameters.
When cooperated with OpenStack, scoped user token can be generated by specifying unscoped token (id) or scoped token (id) issued by OpenStack(Identity).

Endpoint(URL)

http(s)://API SERVER:PORT/v1/user/tokens

with credentials

Content-Type: application/json

with an unscoped user token

Content-Type: application/json
x-auth-token: U=<Unscoped User Token>

with OpenStack (un)scoped token(id)

Content-Type: application/json
x-auth-token: U=<OpenStack (un)scoped token(id)>

Request Body

With credentials

{
    auth: {
        tenantName:      <tenant name>,
        passwordCredentials:    {
            username:    <user name>
            password:    <pass phrase>
        }
    }
}

with an unscoped user token

{
    auth: {
        tenantName:      <tenant name>,
    }
}

response unscoped user token with OpenStack (un)scoped token(id)

(n/a)

response scoped user token with OpenStack (un)scoped token(id)

{
    auth: {
        tenantName:      <tenant name>,
    }
}

Response status

200、40x

Response Body(JSON)

{
    result:     <true/false>
    message:    <null or error message string>
    scoped:     <true/false>
    token:      <token string>
}

PUT

Unscoped user token

Creates an unscoped user token, which is a token without explicit scope of authorization. Credentials are required. See the information below for request parameters.
When cooperated with OpenStack, unscoped user token can be generated by specifying unscoped token (id) or scoped token (id) issued by OpenStack(Identity).

Scoped user token

Creates a scoped user token, which is a token scoped to a tenant(or project). Credentials or unscoped user token is required. See the information below for request parameters.
When cooperated with OpenStack, scoped user token can be generated by specifying unscoped token (id) or scoped token (id) issued by OpenStack(Identity).

Endpoint(URL)

http(s)://API SERVER:PORT/v1/user/tokens?urlarg

Header

With credential

Content-Type: application/json

With unscoped user token

Content-Type: application/json
x-auth-token: U=<Unscoped User Token>

With OpenStack (un)scoped token(id)

Content-Type: application/json
x-auth-token: U=<OpenStack (un)scoped token(id)>

URL Arguments

With Credential

With unscoped user token

Response unscoped user token with OpenStack (un)scoped token(id)

n/a

Response scoped user token with OpenStack (un)scoped token(id)

Response status

200、40x

Response Body(JSON)

{
    result:     <true/false>
    message:    <null or error message string>
    scoped:     <true/false>
    token:      <token string>
}

GET

Validates and shows information for a token, including its authorization scope. An unscoped user token or a scoped user token is required.

Endpoint(URL)

http(s)://API SERVER:PORT/v1/user/tokens

Header

Content-Type: application/json
x-auth-token: U=<Unscoped User Token or Scoped User Token>

Response status

200、40x

Response Body(JSON)

{
    result:     <true/false>
    message:    <null or error message string>
    scoped:     <true/false>
    user:       <user name>
    tenants:    [
        {
            name:       <tenant name>
            display:    <display tenant name>
            id:          <tenant id>
            description: <description for tenant>
        },
        ...
    ]
}

Validates a token.

Endpoint(URL)

http(s)://API SERVER:PORT/v1/user/tokens

Header

Content-Type: application/json
x-auth-token: U=<Unscoped User Token or Scoped User Token>

Response status

204、40x

Response Body(JSON)

Empty

VERSION API REST API LIST API