Reserve resources from a pool
curl --request POST \
--url https://api.example.com/inventory/pools/{poolId}/reserve \
--header 'Content-Type: application/json' \
--header 'client_id: <api-key>' \
--header 'secret_key: <api-key>' \
--data '
{
"count": 4,
"attributes": {}
}
'import requests
url = "https://api.example.com/inventory/pools/{poolId}/reserve"
payload = {
"count": 4,
"attributes": {}
}
headers = {
"client_id": "<api-key>",
"secret_key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
client_id: '<api-key>',
secret_key: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({count: 4, attributes: {}})
};
fetch('https://api.example.com/inventory/pools/{poolId}/reserve', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/inventory/pools/{poolId}/reserve",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'count' => 4,
'attributes' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"client_id: <api-key>",
"secret_key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/inventory/pools/{poolId}/reserve"
payload := strings.NewReader("{\n \"count\": 4,\n \"attributes\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("client_id", "<api-key>")
req.Header.Add("secret_key", "<api-key>")
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))
}HttpResponse<String> response = Unirest.post("https://api.example.com/inventory/pools/{poolId}/reserve")
.header("client_id", "<api-key>")
.header("secret_key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"count\": 4,\n \"attributes\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/inventory/pools/{poolId}/reserve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["client_id"] = '<api-key>'
request["secret_key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"count\": 4,\n \"attributes\": {}\n}"
response = http.request(request)
puts response.read_body{
"resources": [
{
"id": "<string>",
"brokerId": "<string>",
"typeId": "<string>",
"metadata": {},
"attributes": {},
"reservationTTL": 1,
"associatedResourceIds": [
"<string>"
],
"createdAt": "<string>",
"updatedAt": "<string>",
"externalCode": "<string>",
"location": "<string>",
"poolId": "<string>",
"reservationId": "<string>",
"reservedAt": "<string>",
"quarantineTTL": 1,
"quarantinedAt": "<string>"
}
],
"reservationId": "<string>"
}Inventory
Reserve resources
POST
/
inventory
/
pools
/
{poolId}
/
reserve
Reserve resources from a pool
curl --request POST \
--url https://api.example.com/inventory/pools/{poolId}/reserve \
--header 'Content-Type: application/json' \
--header 'client_id: <api-key>' \
--header 'secret_key: <api-key>' \
--data '
{
"count": 4,
"attributes": {}
}
'import requests
url = "https://api.example.com/inventory/pools/{poolId}/reserve"
payload = {
"count": 4,
"attributes": {}
}
headers = {
"client_id": "<api-key>",
"secret_key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
client_id: '<api-key>',
secret_key: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({count: 4, attributes: {}})
};
fetch('https://api.example.com/inventory/pools/{poolId}/reserve', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/inventory/pools/{poolId}/reserve",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'count' => 4,
'attributes' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"client_id: <api-key>",
"secret_key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/inventory/pools/{poolId}/reserve"
payload := strings.NewReader("{\n \"count\": 4,\n \"attributes\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("client_id", "<api-key>")
req.Header.Add("secret_key", "<api-key>")
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))
}HttpResponse<String> response = Unirest.post("https://api.example.com/inventory/pools/{poolId}/reserve")
.header("client_id", "<api-key>")
.header("secret_key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"count\": 4,\n \"attributes\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/inventory/pools/{poolId}/reserve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["client_id"] = '<api-key>'
request["secret_key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"count\": 4,\n \"attributes\": {}\n}"
response = http.request(request)
puts response.read_body{
"resources": [
{
"id": "<string>",
"brokerId": "<string>",
"typeId": "<string>",
"metadata": {},
"attributes": {},
"reservationTTL": 1,
"associatedResourceIds": [
"<string>"
],
"createdAt": "<string>",
"updatedAt": "<string>",
"externalCode": "<string>",
"location": "<string>",
"poolId": "<string>",
"reservationId": "<string>",
"reservedAt": "<string>",
"quarantineTTL": 1,
"quarantinedAt": "<string>"
}
],
"reservationId": "<string>"
}Path Parameters
Body
application/json
⌘I