Using the cURL utility

The OpenStack Networking API is REST-based and can be manipulated directly using HTTP. To make API calls using HTTP, you will need a token. Source the OpenStack credentials file and use the openstack token issue command shown here to retrieve a token:

The --fit-width argument is not necessary in normal operations, but helps make the token ID manageable for demonstration purposes.

To get a list of networks, the command should resemble the following:

    $ curl -v -X GET -H 'X-Auth-Token: <token id>'
http://controller01:9696/v2.0/networks

The output will resemble the following:

In this example, the Neutron API returned a 200 OK response in json format. No networks currently exist, so an empty list was returned. Neutron returns HTTP status codes that can be used to determine if the command was successful.

The OpenStack Networking API is documented at the following URL: https://developer.openstack.org/api-ref/network/v2/.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset