Skip to content

Latest commit

 

History

History
58 lines (45 loc) · 3.31 KB

api-example.md

File metadata and controls

58 lines (45 loc) · 3.31 KB

Example for usage of Limes API

This guide shall introduce you to using the Limes API directly via curl.

Getting a token

If you are not familiar with the standard openstack client, please refer to the OpenStack documentation for how to install and use it. Assuming that you have provided your credentials to the openstack client, get a token with

export OS_AUTH_TOKEN="$(openstack token issue -f value -c id)"

This command will not print any output if it is successful.

Finding Limes

Query the service catalog to find the Limes endpoint. It can be identified by looking for the resources service type:

$ openstack catalog list
+---------------+---------------+--------------------------------------------------------------------------+
| Name          | Type          | Endpoints                                                                |
+---------------+---------------+--------------------------------------------------------------------------+
| keystone      | identity      | staging                                                                  |
|               |               |   public: https://identity.example.com:443/v3                            |
|               |               | staging                                                                  |
|               |               |   internal: http://keystone.openstack.svc.kubernetes.example.com:5000/v3 |
|               |               | staging                                                                  |
|               |               |   admin: https://identity-admin.example.com:443/v3                       |
|               |               |                                                                          |
| ...           | ...           | ...                                                                      |
|               |               |                                                                          |
| limes         | resources     | staging                                                                  |
|               |               |   public: https://limes.example.com                                      |
|               |               |                                                                          |
| ...           | ...           | ...                                                                      |
|               |               |                                                                          |
+---------------+---------------+--------------------------------------------------------------------------+

Using Limes

In this case, the endpoint URL for Limes is https://limes.example.com, so you can build a request URL by appending one of the paths from the API specification. For example, to show quota and usage data for a project, use the following command:

curl -H "X-Auth-Token: $OS_AUTH_TOKEN" https://limes.example.com/v1/domains/$DOMAIN_ID/projects/$PROJECT_ID

$OS_AUTH_TOKEN is the token from the first step. $DOMAIN_ID and $PROJECT_ID need to be set by you to the project ID in question and its domain ID. If you only have a project name, you can get these IDs by calling openstack project show $NAME.