ROLE API REST API POLICY API

RESOURCE API

This page describes the K2HR3 RESOURCE API. The purpose of the RESOURCE API is to create and update and get and delete a K2HR3 RESOURCE. See the Basic Usage about the K2HR3 RESOURCE.

POST

Creates or updates a K2HR3 RESOURCE.

Endpoint(URL)

If a scoped user token request header is specified

http(s)://API SERVER:PORT/v1/resource

If a role token request header is specified

http(s)://API SERVER:PORT/v1/resource/resource path or yrn full resource path

No token specified in the request headers

http(s)://API SERVER:PORT/v1/resource/yrn full resource path

Scoped user token

The following header contains a scoped user token.

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

A role Token

The following header contains a role token.

Content-Type: application/json
x-auth-token: R=<Role Token>

No tokens

The following header contains no token.

Content-Type: application/json

Request Body

A Scoped User Token

{
    resource:    {
        name:    <resource name>
        type:    <data type>
        data:    <resource data>
        keys:    {
            foo:    bar,
            ...
        }
        alias:    [
            <resource yrn full path>,
            ...
        ]
    }
}

Role Token

{
    resource:    {
        type:    <data type>
        data:    <resource data>
        keys:    {
            foo:    bar,
            ...
        }
    }
}

No tokens

{
    resource:    {
        port:    <port number>
        cuk:     <container unique key>
        role:    <role full yrn>
        type:    <data type>
        data:    <resource data>
        keys:    {
            foo:    bar,
            ...
        }
    }
}

Response status

201、40x

Response Body(JSON)

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

PUT

Creates or updates a K2HR3 RESOURCE.

Note: The POST method can be used here as well

Endpoint(URL)

If a scoped user token request header is specified

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

If a role token request header is specified

http(s)://API SERVER:PORT/v1/resource/resource path or yrn full resource path?urlarg

No token specified in the request headers

http(s)://API SERVER:PORT/v1/resource/yrn full resource path?urlarg

Header

Scoped User Token

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

Role Token

Content-Type: application/json
x-auth-token: R=<Role Token>

No Tokens

Content-Type: application/json

URL Arguments

Scoped User Token specified in request headers

Role Token specified in request headers

No Token in request headers

Response status

201、40x

Response Body(JSON)

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

GET

Lists all available resources.

Endpoint(URL)

If a scoped user token request header is specified

http(s)://API SERVER:PORT/v1/resource/resource path or yrn full resource path?urlarg

If a role token request header is specified

http(s)://API SERVER:PORT/v1/resource/resource path or yrn full resource path?urlarg

No token specified in the request headers

http(s)://API SERVER:PORT/v1/resource/yrn full resource path?urlarg

Header

Scoped User Token

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

Role Token

Content-Type: application/json
x-auth-token: R=<Role Token>

Token

Content-Type: application/json

URL Arguments

If a scoped user token request header is specified

If a role token request header is specified

No token specified in the request headers

Response status

200、40x

Response Body(JSON)

If a scoped user token request header is specified

{
    result:     <true/false>
    message:    <null or error message string>
    resource:   {
        string:     <string>,
        object:     <object>,
        keys:       <object>,
        aliases:    <array>
    }
}

a role token request header is specified or No token specified in the request headers

{
    result:     <true/false>
    message:    <null or error message string>
    resource:   <data>
}

Validates that a RESOURCE (including in a SERVICE if specified) exists.

Endpoint(URL)

If a scoped user token request header is specified

http(s)://API SERVER:PORT/v1/resource/resource path or yrn full resource path?urlarg

If a role token request header is specified

http(s)://API SERVER:PORT/v1/resource/resource path or yrn full resource path?urlarg

No token specified in the request headers

http(s)://API SERVER:PORT/v1/resource/yrn full resource path?urlarg

Header

Scoped User Token

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

Role Token

Content-Type: application/json
x-auth-token: R=<Role Token>

No token

Content-Type: application/json

URL Arguments

If a scoped user token request header is specified

If a role token request header is specified

No token specified in the request headers

Response status

204、40x

Response Body(JSON)

Empty

DELETE

Deletes a part of a RESOURCE or a RESOURCE.

Endpoint(URL)

If a scoped user token request header is specified

http(s)://API SERVER:PORT/v1/resource/resource path or yrn full resource path?urlarg

If a role token request header is specified

http(s)://API SERVER:PORT/v1/resource/resource path or yrn full resource path?urlarg

No token specified in the request headers

http(s)://API SERVER:PORT/v1/resource/yrn full resource path?urlarg

Header

Scoped User Token

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

Role Token

Content-Type: application/json
x-auth-token: R=<Role Token>

No Token

Content-Type: application/json

URL Arguments

Scoped User Token

Response status

204、40x

Response Body(JSON)

Empty

ROLE API REST API POLICY API