Batch enroll servers
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
servers: [
{
hostname: '<string>',
bmcAddress: '<string>',
serialNumber: '<string>',
tags: {}
}
]
})
};
fetch('https://api.example.com/v1/regions/{region}/infrastructure/servers/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/regions/{region}/infrastructure/servers/batch"
payload := strings.NewReader("{\n \"servers\": [\n {\n \"hostname\": \"<string>\",\n \"bmcAddress\": \"<string>\",\n \"serialNumber\": \"<string>\",\n \"tags\": {}\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}curl --request POST \
--url https://api.example.com/v1/regions/{region}/infrastructure/servers/batch \
--header 'Content-Type: application/json' \
--data '
{
"servers": [
{
"hostname": "<string>",
"bmcAddress": "<string>",
"serialNumber": "<string>",
"tags": {}
}
]
}
'import requests
url = "https://api.example.com/v1/regions/{region}/infrastructure/servers/batch"
payload = { "servers": [
{
"hostname": "<string>",
"bmcAddress": "<string>",
"serialNumber": "<string>",
"tags": {}
}
] }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": [
{
"id": "<string>",
"hostname": "<string>",
"status": "available",
"health": "healthy",
"regionId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"serialNumber": "<string>",
"bmcAddress": "<string>",
"profileId": "<string>",
"specs": {
"cpu": "<string>",
"memoryGB": 123,
"storageGB": 123,
"nics": 123
},
"tags": {},
"updatedAt": "2023-11-07T05:31:56Z"
}
],
"meta": {
"total": 123
}
}Servers
Batch enroll servers
Enroll multiple servers at once. Accepts an array of server objects.
POST
/
v1
/
regions
/
{region}
/
infrastructure
/
servers
/
batch
Batch enroll servers
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
servers: [
{
hostname: '<string>',
bmcAddress: '<string>',
serialNumber: '<string>',
tags: {}
}
]
})
};
fetch('https://api.example.com/v1/regions/{region}/infrastructure/servers/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/regions/{region}/infrastructure/servers/batch"
payload := strings.NewReader("{\n \"servers\": [\n {\n \"hostname\": \"<string>\",\n \"bmcAddress\": \"<string>\",\n \"serialNumber\": \"<string>\",\n \"tags\": {}\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}curl --request POST \
--url https://api.example.com/v1/regions/{region}/infrastructure/servers/batch \
--header 'Content-Type: application/json' \
--data '
{
"servers": [
{
"hostname": "<string>",
"bmcAddress": "<string>",
"serialNumber": "<string>",
"tags": {}
}
]
}
'import requests
url = "https://api.example.com/v1/regions/{region}/infrastructure/servers/batch"
payload = { "servers": [
{
"hostname": "<string>",
"bmcAddress": "<string>",
"serialNumber": "<string>",
"tags": {}
}
] }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": [
{
"id": "<string>",
"hostname": "<string>",
"status": "available",
"health": "healthy",
"regionId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"serialNumber": "<string>",
"bmcAddress": "<string>",
"profileId": "<string>",
"specs": {
"cpu": "<string>",
"memoryGB": 123,
"storageGB": 123,
"nics": 123
},
"tags": {},
"updatedAt": "2023-11-07T05:31:56Z"
}
],
"meta": {
"total": 123
}
}Was this page helpful?