Ask Your Question
0

How to use the postman invoke the openstack API ?

asked 2017-08-16 06:22:19 -0500

liaodalin19903 gravatar image

I have installed the HA openstack in 3 nodes,

and in the dashboard Access&Security:

Identity    http://bcd.abc.com:5000/v3
Network http://bcd.abc.com:9696
Image   http://bcd.abc.com:9292
Compute http://bcd.abc.com:8774/v2.1/0d5998f2f7ec4c4892a32e06bafb19df

the bcd.abc.com's ip is 45.117.40.168, on the host machine I can ping it. I just want to test the API in the postman, how to do with that?

image description

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-08-16 07:40:43 -0500

liaodalin19903 gravatar image

I figured out it:

I use the command requested the token firstly(Can use postman request also):

curl -k -X 'POST' -v http://45.117.40.168:5000/v2.0/tokens -d '{"auth":{"passwordCredentials":{"username": "admin", "password":"123456"}}}' -H 'Content-type: application/json' | python -mjson.tool 

......
< Content-Type: application/json
< 
{ [data not shown]
100   578  100   501  100    77    795    122 --:--:-- --:--:-- --:--:--   796
* Closing connection 0
{
    "access": {
        "metadata": {
            "is_admin": 0,
            "roles": []
        },
        "serviceCatalog": [],
        "token": {
            "audit_ids": [
                "HqVGww9JT2G2wSKzd9v3uA"
            ],
            "expires": "2017-08-16T13:16:14Z",
            "id": "gAAAAABZlDeOO4s1MCfXFP_b9CTl_Znndpt6piBxLRiMTR2TpMp3EfA49chql2a1nfowQST-pQCqaBe53KBuRNx4moj3RYCIiS24xDALDhqpeYBSkfnVM1EP6dTSKOtEGuQGBNGe5v4RIlzu0ZXKYrmoWPgA7ZFRiw",
            "issued_at": "2017-08-16T12:16:14.000000Z"
        },
        "user": {
            "id": "2a5fa182fb1b459980db09cd1572850e",
            "name": "admin",
            "roles": [],
            "roles_links": [],
            "username": "admin"
        }
    }
}

The token->id is the token.

So in the postman I can use the token now:

give a param X-Auth-Token, its value is the upper token.

image description

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2017-08-16 06:22:19 -0500

Seen: 2,839 times

Last updated: Aug 16 '17

Related questions