Getting startes with the OpenStack API
This guide help you to manage your instances using the Python OpenStack client or Calling Request API.
Requirements
Register NIPA Cloud Space portal
Access project or create new one and Topup wallet first.
Download Openrc file from your project
1. Using OpenStack Client Tools
1.1 Requirements
Please refer to the following guides:
Preparing an environment for using the Openstack API
On Ubuntu:
update packet cache
Install Python3 before installing the OpenStack client
install the OpenStack client
verify by accessing the help tools
Setting environment for using the Openstack
Download Openrc file from our portal
On Ubuntu
Use
source
command and enter your password to login Horizonsource <openrc.sh file>
1.2 Instructions
You can obtain the list of possible commands by reading the embedded documentation:
You can filter the commands displayed by indicating the group.
It is also possible to get information about a command by adding "help" in front of it:
1.3 Example Create Instance With OpenStack Commandline
spec
Instance name: Instance-2001
Flavor: csa.large.v2
Volume: standard-ssd 40 GB
VPC : default
list flavor
list network/subnet
list security group
list keypair
create instance
Ex.
Verify that the instance is created using this command.
Note : you can add option --debug to get information about request body and response body of you api request
2. Using API Request
Request an authentication token from the Identity endpoint that your cloud administrator gave you. Send a payload of credentials in the request as shown in Authenticate. If the request succeeds, the server returns an authentication token.
Send API requests and include the token in the X-Auth-Token
header. Continue to send API requests with that token until the service completes the request or the Unauthorized (401) error occurs.
If the Unauthorized (401) error occurs, request another token.
Example body
example command
If the request succeeds, it returns the Created (201)
response code along with the token as a value in the X-Subject-Token
response header. The header is followed by a response body that has an object of type token
which has the token expiration date and time in the form "expires_at":"datetime"
along with other attributes.
2.1 Example list instance via Send API requests
This section shows how to make some basic Compute API calls. For a complete list of Compute API calls, see Compute API.
Export the token ID to the OS_TOKEN
environment variable. For example:
You need to know the Url of service compute, this is include in response of keystone login body.
Then, use the Compute API to list flavors, substituting the Compute API endpoint with one containing your project ID below:
sent stop instance api
Ex.
2.2 referrent
keystone api ref : https://docs.openstack.org/api-ref/identity/v3/
glace api ref : https://docs.openstack.org/api-ref/image/v2/
nova api ref : https://docs.openstack.org/api-ref/compute/
cinder api ref : https://docs.openstack.org/api-ref/block-storage/v3/
Last updated