Custom Search

Sunday, December 22, 2013

How to Test OpenStack Keystone API using RESTClient Firefox Chrome

http://adam.younglogic.com/2013/09/keystone-v3-api-examples/
https://github.com/openstack/identity-api/blob/master/openstack-identity-api/v3/src/markdown/identity-api-v3.md <== API

Core API
###############


a)
*List All API Versions

*https://github.com/openstack/identity-api/blob/master/openstack-identity-api/v3/src/markdown/identity-api-v3.md#list-versions-get-
*URL: http://192.168.56.101:5000/
*Method: GET



b)
*Authenticate

*https://github.com/openstack/identity-api/blob/master/openstack-identity-api/v3/src/markdown/identity-api-v3.md#authenticate-post-authtokens
*URL: http://192.168.56.101:5000/v3/auth/tokens
*Method: POST
*Request Headers:
Content-type : application/json
*Request Body:
Login as admin using the method password.
-----
{
    "auth": {
        "identity": {
            "methods": [
                "password"
            ],
            "password": {
                "user": {
                    "name": "admin",
                    "password": "password",
                    "domain": {
                               "name":"Default"
                            }

                }
            }
        }
    }
}

*You can find the "X-Subject-Token" from the response header of this request.
X-Subject-Token: 6f9723ef28de4cdaaa72327ad3ab3e0d

c)
*Validate Token

*https://github.com/openstack/identity-api/blob/master/openstack-identity-api/v3/src/markdown/identity-api-v3.md#validate-token-get-authtokens
*URL: http://192.168.56.101:5000/v3/auth/tokens
*Method: GET
*Request Headers:
X-Auth-Token: tokentoken
X-Subject-Token: 6f9723ef28de4cdaaa72327ad3ab3e0d


d)
*Check Token

*https://github.com/openstack/identity-api/blob/master/openstack-identity-api/v3/src/markdown/identity-api-v3.md#check-token-head-authtokens
*URL: http://192.168.56.101:5000/v3/auth/tokens
*Method: HEAD
*Request Headers:
X-Auth-Token: tokentoken
X-Subject-Token: c675805436575fs5dvt2sd32f


e)
*Revoke/Delete Token

*https://github.com/openstack/identity-api/blob/master/openstack-identity-api/v3/src/markdown/identity-api-v3.md#revoke-token-delete-authtokens
*URL: http://192.168.56.101:5000/v3/auth/tokens
*Method: DELETE
*Request Headers:
X-Auth-Token: tokentoken
X-Subject-Token: c675805436575fs5dvt2sd32f


Projects
#############


a)
*Create Projects

*https://github.com/openstack/identity-api/blob/master/openstack-identity-api/v3/src/markdown/identity-api-v3.md#create-project-post-projects
*URL: http://192.168.56.101:5000/v3/projects
*Method: POST
*Request Headers:
X-Auth-Token: tokentoken
Content-type : application/json

*Request Body:
{
    "project": {
        "description": "description1",
        "domain_id": "default",
        "enabled": true,
        "name": "MyProject1"
    }
}


b)
*List Projects

*https://github.com/openstack/identity-api/blob/master/openstack-identity-api/v3/src/markdown/identity-api-v3.md#list-projects-get-projects
*URL: http://192.168.56.101:5000/v3/projects
*Method: GET
*Request Headers:
X-Auth-Token: tokentoken

c)
*Get Project

*https://github.com/openstack/identity-api/blob/master/openstack-identity-api/v3/src/markdown/identity-api-v3.md#get-project-get-projectsproject_id
*URL: http://192.168.56.101:5000/v3/projects/a265e326b5f243f5bccdf5fdc537b8f2
*Method: GET
*Request Headers:
X-Auth-Token: tokentoken

d)
*Update Project

*https://github.com/openstack/identity-api/blob/master/openstack-identity-api/v3/src/markdown/identity-api-v3.md#update-project-patch-projectsproject_id
*URL: http://192.168.56.101:5000/v3/projects/a265e326b5f243f5bccdf5fdc537b8f2
*Method: PATCH
*Request Headers:
X-Auth-Token: tokentoken
Content-type : application/json

*Request Body:
{
    "project": {
        "description": "description2",
        "domain_id": "default",
        "enabled": true,
        "name": "MyProject_new_name"
    }
}

*I could not find the request method "PATCH" in restclient firefox Addon.
*Note: Use Google chrome browser with "Advanced Rest Client" extension for PATCH option (Works).

e)
*Delete Project

*https://github.com/openstack/identity-api/blob/master/openstack-identity-api/v3/src/markdown/identity-api-v3.md#get-project-get-projectsproject_id
*URL: http://192.168.56.101:5000/v3/projects/a265e326b5f243f5bccdf5fdc537b8f2
*Method: DELETE
*Request Headers:
X-Auth-Token: tokentoken

5 comments:

  1. i follow steps of Authenticate it's working and give me 201 response but the header X-Subject-Token is containg 4093 words token
    and when i am try to validate the token by given steps is show
    {
    "error": {
    "message": "The request you have made requires authentication.",
    "code": 401,
    "title": "Unauthorized"
    }
    }

    Any One Tell me Why i got this error ..?
    Please Help me And Thanks In Advance

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. I found it, its in keystone.conf file.provide X-Auth-Token value from keystone.conf file, the value of admin_token.

    ReplyDelete
  4. can you explain what is "X-Auth-Token: tokentoken" here

    ReplyDelete
  5. excellent material. Thanks for sharing.

    ReplyDelete