v1.2 initial commit

This commit is contained in:
Marco Mooij | DigiState
2026-05-13 09:56:43 +02:00
commit a160d31953
58 changed files with 8019 additions and 0 deletions

19
API/Getting Started.md Normal file
View File

@@ -0,0 +1,19 @@
This document will explain how to get started with the Sentri API.
## Requirements
To connect to the Sentri API, you will need the following:
- A basic understanding of how APIs work, along with some programming or scripting experience.
- The Sentri base URL.
- An API bearer token.
- Network access from the devices making API requests to the Sentri service on port 443.
## Creating a authentication bearer token
Make sure you have the `user-apitoken-self` read/write permission, as this allows you to create an authentication bearer token.
Once logged in, go to your profile at `/userprofile` and click Generate API Token.
A token will be displayed, as shown below. This token will be used as the authentication bearer token, so make sure to copy it as it will only be shown once.
```
c8aaf11d-e10e-11f0-9b16-00155d00153f.83f0383262a4875f6c6d4bb5aa8577818ca7f71cb2ba80b9e9b9cb43f5b86831
```
## Trouble shooting
When you encounter a problem with the API, you will most likely receive an HTTP status code in the response. This code can help indicate the nature of the issue.
### Response codes
These are some of the response codes you may receive when making a call to the API:

View File

@@ -0,0 +1,149 @@
This API call creates a server or updates it with the given information.
#### Location
```
/api/v1/servers/
```
#### Permissions required
`servers` RW
#### Body parameters
| Parameter | Type | Required | Description |
| -------------------- | ------------------------------------------------------ | -------- | ----------------------------------------- |
| server_vm_host_id | string | yes | Unique id of the vm |
| server_vm_host_name | string | no | Name of the vm |
| company_uuid | string | no | Company_uuid from companies |
| server_power_state | enum ['Running', 'Off'] | no | If the vm is on or off |
| server_state | enum ['new', 'active', 'deleted', 'trial', 'disabled'] | no | Server state. 'new' is the default |
| server_hostname | string | no | Hostname of the server |
| server_os | string | no | Server operating system |
| server_cpu | int | no | Amount of cpu used by the server |
| server_memory | int | no | Amount of memory used by the server in MB |
| server_memory_demand | int | no | Amount memory demand by the server in MB |
| server_disks | array | no | Array of the servers disks |
| server_ipv4 | array | no | Array of the ipv4 addresses in a list |
| server_ipv6 | json | no | Array of the ipv6 addresses in a list |
| server_vm_generation | int | no | VM machine generation or version |
| server_vm_snapshot | int | no | Amount of snapshots made of the vm |
| server_licenses | json | no | Array of the server licenses |
| server_backup | json | no | Array of the server backups |
| server_description | string | no | description of the server |
>[!note]
> If the current `server_state` is _new_ and the posted `server_state` is _deleted_, the server will be permanently deleted. Otherwise, if the current state is not _new_, the `server_state` will simply be updated to _deleted_ without permanent removal."
#### server_disks parameters
| Parameter | Type | Required | Description |
| ------------- | ------ | -------- | -------------------------------------------------------------------------------------------- |
| disk_name | string | yes | Name of the disk |
| disk_space | float | yes | The file space of the vhd that is reserved. |
| disk_used | float | yes | the real space used on the server for the vhd file. Can be used for dynamically sized disks. |
| disk_location | string | yes | The real location of the vhd file. |
#### server_licenses parameters
When posting `server_licenses`, you must include a prefix before each license name. Use **+** to
add or register a license, and **-** to ensure the license is not registered in Sentri. This ensures that
any license a server no longer has is automatically removed from Sentri.
| Parameter | Type | Required | Description |
| -------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------ |
| *license name* | string | yes | Name of a license |
| *license type* | string | yes | Type the license like, **super-plus** or **plus**. If this is not applicable, name it the same as the license name |
#### server_backup parameters
When posting `server_backup`, you must include a prefix before each backup name. Use **+** to
add or register a backup, and **-** to ensure the backup is not registered in Sentri. This ensures that
any backup a server no longer has is automatically removed from Sentri.
| Parameter | Type | Required | Description |
| ------------- | ------ | -------- | ------------------------------------------------------------------- |
| *backup name* | string | yes | Name of the backup |
| *backup type* | string | yes | Type of the backup. You can put here yes or the type of the backup. |
### Example Body (json)
```json
{
"server_vm_id": "00155d001d3f",
"server_vm_host_name": "web01.test.example.nl",
"server_power_state": "Running",
"server_state": "new",
"server_hostname": "web01.test.example.nl",
"server_os": "AlmaLinux 10.1",
"server_cpu": 1,
"server_memory": 2048,
"server_memory_demand": 1267,
"server_disks": [
{
"disk_name": "server_datadisk.vhdx",
"disk_space": "150",
"disk_used": "140.5",
"disk_location": "C:\\ClusterStorage\\vol07\\web01.test\\VHD\\"
}
],
"server_ipv4": [
"123.12.34.113",
"123.12.34.134"
],
"server_ipv6": [
"2a01:4c66:4:2:44::1",
"2a01:4c66:4:2:45::2"
],
"server_vm_generation": 2,
"server_vm_snapshot": 1,
"server_licenses": [
{ "+directadmin": "Discounted Standard" },
{ "+cpguard": "cpguard" },
{ "-installatron": "none" }
],
"server_backup": [
{ "+borg": "yes" }
],
"server_description": "test web server"
}
```
#### Multiple servers
It is possible to post multiple servers in one request. Put the different servers in an array like below:
```json
{
"servers": [
{
"server_vm_id": "00155d001d3d",
"server_vm_host_name": "web01.test.example.nl"
},
{
"server_vm_id": "00155d001d3f",
"server_vm_host_name": "web02.test.example.nl"
}
]
}
```
### Example Request
```php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://sentri.nl/api/v1/servers/',
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <API your Bearer token>",
],
CURLOPT_POST => true,
CURLOPT_POSTFIELDS =>'<json payload body>',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
```
### Example Response
```json
"Server(s) modified or updated successfully."
```
#### Known errors or issues.
None are known at the time.
If you do encounter issues and get an http code in return, check the response codes on this page.

View File

@@ -0,0 +1,44 @@
This API call synchronizes active companies in Sentri with the corresponding cloud distributor companies in Inserve. These cloud distributor companies are required to associate Sentri server licenses with companies in Inserve.
#### Location
```
/api/v1/sources/inserve/sync-cloud-distributor/
```
#### Permissions required
`servers` RW
#### Body parameters
None.
### Example Body (json)
None.
### Example Request
```php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://sentri.nl/api/v1/sources/inserve/sync-cloud-distributor/',
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <API your Bearer Token>",
"Accept: application/json",
"Content-Type: application/json"
]
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
```
### Example Response
```json
"Sync is done successfully"
```
#### Known errors or issues.
None are known at the time
If you do encounter issues and get an http code in return, check the response codes on this page.

View File

@@ -0,0 +1,44 @@
This API call retrieves all companies from Inserve and creates or updates them in Sentri.
#### Location
```
/api/v1/sources/inserve/sync-companies/
```
#### Permissions required
`servers` RW
#### Body parameters
None.
### Example Body (json)
None.
### Example Request
```php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://sentri.nl/api/v1/sources/inserve/sync-companies/',
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <API your Bearer Token>",
"Accept: application/json",
"Content-Type: application/json"
]
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
```
### Example Response
```json
"Sync is done successfully"
```
#### Known errors or issues.
None are known at the time
If you do encounter issues and get an http code in return, check the response codes on this page.

View File

@@ -0,0 +1,44 @@
This API call first executes the [[GET Sync cloud distributor|GET Sync cloud distributor]] action and then synchronizes all servers in an active, deleted, or trial state with Inserve licenses. It creates or updates server licenses in Inserve if they do not exist or if the license quantities differ from those in Sentri.
#### Location
```
/api/v1/sources/inserve/sync-cloud-licenses/
```
#### Permissions required
`servers` RW
#### Body parameters
None.
### Example Body (json)
None.
### Example Request
```php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://sentri.nl/api/v1/sources/inserve/sync-cloud-licenses/',
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <API your Bearer Token>",
"Accept: application/json",
"Content-Type: application/json"
]
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
```
### Example Response
```json
"Sync is done successfully"
```
#### Known errors or issues.
None are known at the time
If you do encounter issues and get an http code in return, check the response codes on this page.

View File

@@ -0,0 +1,44 @@
This API call first executes the [[GET Sync cloud distributor|GET Sync cloud distributor]] action and then synchronizes all servers in an active or trial state to Inserve subscriptions. It creates or updates server subscriptions in Inserve if they do not exist or if the subscription name differ from those in Sentri. For this action the correct inserve `product_codes` should be defined at Portal Management > Sources > Inserve > Custom source data.
#### Location
```
/api/v1/sources/inserve/sync-server-subscriptions
```
#### Permissions required
`servers` RW
#### Body parameters
None.
### Example Body (json)
None.
### Example Request
```php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://sentri.nl/api/v1/sources/inserve/sync-server-subscriptions/',
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <API your Bearer Token>",
"Accept: application/json",
"Content-Type: application/json"
]
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
```
### Example Response
```json
"Sync is done successfully"
```
#### Known errors or issues.
None are known at the time
If you do encounter issues and get an http code in return, check the response codes on this page.