as shown in Figure 1
Here in the url area I entered the rest api url, select post option and send in a json request to get the token, I entered the username and password and the tenantName, which can be got from the Openstack horizon dashboard. After this request is submitted I got a response back with the token as seen in figure 3
Figure 3
From figure 3 I can see issue time of the token and also the token id (6a8e0a8962464f37a291035099110fd8), I will use this id in my api calls. When I get unable to authenticate exception then that means the token has expired and need to repeat the above process.
Now with this new found token id, lets try a few tasks via the api
Lets try to get a list of tenants(projects) through the api
Api is http://10.81.95.139:5000/v2.0/tenants
note the difference from the earlier one, which had tokens because we requested the tokens then. Do a get request from the client as shown in figure 4
Figure 4
As can be seen from figure 4 I have the api url and then include the token as a header value from openstack to know user is authenticated. Once this is submitted I get a json response with all the details of the tenants as shown in Figure 5
Figure 5
Lets say we need a list of all instances in the system, the url would be
http://10.81.95.139:8774/v2/09d3a0ca0ea0428abd62727c336121c5/servers
Notice the difference in the url pattern, now I access the Nova compute unlike before where I accessed the Identity service. In a minute i'll explain how to get the url's for different components in openstack.. Now look at figure 6 to see the response of the list servers call
I can decipher from this we have two servers running arun1 and arun, gives details about the servers aswell.
Now coming back to getting the urls of the components, login into the horizon dashboard and access the access and security option as shown in figure 7. This will list all the base api urls for openstack api's.
Figure 7
Conclusion: From this blog I can say it is fairly easy to access all the openstack features using the rest api. It is as simple as first authenticate get the token and then use the token in all other api calls as a header value as described in the blog.