# REST API
Every administering operation regarding Oneprovider configuration can be done using Onepanel REST API. It helps to automate tasks like storage creation, space support, etc. without the need to interact with a web browser.
# API endpoints location
API endpoints are available in two locations. The first one is attached directly to the domain of Oneprovider at a standard port. It is useful for the majority of use cases:
https://my.oneprovider.domain.org/api/v3/onepanel/{...}
All incoming calls to such Onepanel API endpoints are internally proxied by the Oneprovider to the underlying Onepanel.
The second one becomes handy when the Oneprovider itself is malfunctioning (so it cannot proxy our API calls) and/or we want to connect from within the cluster's local network.
https://my.oneprovider.domain.org:9443/api/v3/onepanel/{...}
Port 9443 indicates, that we want to connect directly to the Onepanel service
without proxying via Oneprovider.
# Authentication
Access tokens are used universally to authorize API requests in all services. Follow this quickstart guide to acquire an access token.
In emergency cases, it is also possible to authenticate using the emergency passphrase — a secret password, which is not assigned to any user and gives full control over the cluster.
How to use both of these methods is described in detail in this (opens new window) section of our API documentation.
# Available operations
All possible operations and how to use them are described in our API documentation (opens new window). The most popular ones include:
| Request | Link to API |
|---|---|
| Get public configuration | API (opens new window) |
| Check cluster health | API (opens new window) |
| Add storage backend | API (opens new window) |
| List storage backends | API (opens new window) |
| Get storage backend details | API (opens new window) |
| Support space | API (opens new window) |
| List supported spaces | API (opens new window) |
| Get space support details | API (opens new window) |
# Example request
Let's assume, that your provider is located at my.provider.domain.org and your
access token is available under TOKEN environment variable. You can get the
list of provider storage backends using cURL command:
curl -X GET -H "X-Auth-Token: $TOKEN" https://my.provider.domain.org/api/v3/onepanel/provider/storages
The result of the above request will contain a list of storage backend IDs:
{
"ids": [
"18a42a43b1b2d92455ffa09e9a15df7fch4f82",
"0a26877440f6ce457106c6958dfe7ecbch0ac6",
"b3d7d10504393556d9b1631a74c34520ch8359"
]
}