Upsert device inventory projection (internal)
curl --request POST \
--url https://api.example.com/api/v1/inventory/device-projections/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"netbox_id": 2,
"source_updated_at": "2023-11-07T05:31:56Z",
"bmc_ip": "<string>",
"asset_tag": "",
"description": "",
"custom_fields": {},
"site_netbox_id": 2,
"primary_ip": "<string>",
"device_type_part_number": "<string>",
"device_type_u_height": 123,
"site_description": "<string>",
"site_region": "<string>",
"site_syslog_server": "<string>",
"fru": [
{
"serial_number": "<string>",
"part_number": "<string>",
"model_number": "<string>"
}
],
"interfaces": [
{
"name": "<string>",
"type": "<string>",
"type_display": "<string>",
"ip_addresses": [
"<string>"
],
"mac_address": "<string>",
"ib_device_guid": "<string>"
}
]
}
'import requests
url = "https://api.example.com/api/v1/inventory/device-projections/"
payload = {
"netbox_id": 2,
"source_updated_at": "2023-11-07T05:31:56Z",
"bmc_ip": "<string>",
"asset_tag": "",
"description": "",
"custom_fields": {},
"site_netbox_id": 2,
"primary_ip": "<string>",
"device_type_part_number": "<string>",
"device_type_u_height": 123,
"site_description": "<string>",
"site_region": "<string>",
"site_syslog_server": "<string>",
"fru": [
{
"serial_number": "<string>",
"part_number": "<string>",
"model_number": "<string>"
}
],
"interfaces": [
{
"name": "<string>",
"type": "<string>",
"type_display": "<string>",
"ip_addresses": ["<string>"],
"mac_address": "<string>",
"ib_device_guid": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
netbox_id: 2,
source_updated_at: '2023-11-07T05:31:56Z',
bmc_ip: '<string>',
asset_tag: '',
description: '',
custom_fields: {},
site_netbox_id: 2,
primary_ip: '<string>',
device_type_part_number: '<string>',
device_type_u_height: 123,
site_description: '<string>',
site_region: '<string>',
site_syslog_server: '<string>',
fru: [{serial_number: '<string>', part_number: '<string>', model_number: '<string>'}],
interfaces: [
{
name: '<string>',
type: '<string>',
type_display: '<string>',
ip_addresses: ['<string>'],
mac_address: '<string>',
ib_device_guid: '<string>'
}
]
})
};
fetch('https://api.example.com/api/v1/inventory/device-projections/', 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/api/v1/inventory/device-projections/",
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([
'netbox_id' => 2,
'source_updated_at' => '2023-11-07T05:31:56Z',
'bmc_ip' => '<string>',
'asset_tag' => '',
'description' => '',
'custom_fields' => [
],
'site_netbox_id' => 2,
'primary_ip' => '<string>',
'device_type_part_number' => '<string>',
'device_type_u_height' => 123,
'site_description' => '<string>',
'site_region' => '<string>',
'site_syslog_server' => '<string>',
'fru' => [
[
'serial_number' => '<string>',
'part_number' => '<string>',
'model_number' => '<string>'
]
],
'interfaces' => [
[
'name' => '<string>',
'type' => '<string>',
'type_display' => '<string>',
'ip_addresses' => [
'<string>'
],
'mac_address' => '<string>',
'ib_device_guid' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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/api/v1/inventory/device-projections/"
payload := strings.NewReader("{\n \"netbox_id\": 2,\n \"source_updated_at\": \"2023-11-07T05:31:56Z\",\n \"bmc_ip\": \"<string>\",\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"custom_fields\": {},\n \"site_netbox_id\": 2,\n \"primary_ip\": \"<string>\",\n \"device_type_part_number\": \"<string>\",\n \"device_type_u_height\": 123,\n \"site_description\": \"<string>\",\n \"site_region\": \"<string>\",\n \"site_syslog_server\": \"<string>\",\n \"fru\": [\n {\n \"serial_number\": \"<string>\",\n \"part_number\": \"<string>\",\n \"model_number\": \"<string>\"\n }\n ],\n \"interfaces\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"type_display\": \"<string>\",\n \"ip_addresses\": [\n \"<string>\"\n ],\n \"mac_address\": \"<string>\",\n \"ib_device_guid\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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/api/v1/inventory/device-projections/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"netbox_id\": 2,\n \"source_updated_at\": \"2023-11-07T05:31:56Z\",\n \"bmc_ip\": \"<string>\",\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"custom_fields\": {},\n \"site_netbox_id\": 2,\n \"primary_ip\": \"<string>\",\n \"device_type_part_number\": \"<string>\",\n \"device_type_u_height\": 123,\n \"site_description\": \"<string>\",\n \"site_region\": \"<string>\",\n \"site_syslog_server\": \"<string>\",\n \"fru\": [\n {\n \"serial_number\": \"<string>\",\n \"part_number\": \"<string>\",\n \"model_number\": \"<string>\"\n }\n ],\n \"interfaces\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"type_display\": \"<string>\",\n \"ip_addresses\": [\n \"<string>\"\n ],\n \"mac_address\": \"<string>\",\n \"ib_device_guid\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/inventory/device-projections/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"netbox_id\": 2,\n \"source_updated_at\": \"2023-11-07T05:31:56Z\",\n \"bmc_ip\": \"<string>\",\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"custom_fields\": {},\n \"site_netbox_id\": 2,\n \"primary_ip\": \"<string>\",\n \"device_type_part_number\": \"<string>\",\n \"device_type_u_height\": 123,\n \"site_description\": \"<string>\",\n \"site_region\": \"<string>\",\n \"site_syslog_server\": \"<string>\",\n \"fru\": [\n {\n \"serial_number\": \"<string>\",\n \"part_number\": \"<string>\",\n \"model_number\": \"<string>\"\n }\n ],\n \"interfaces\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"type_display\": \"<string>\",\n \"ip_addresses\": [\n \"<string>\"\n ],\n \"mac_address\": \"<string>\",\n \"ib_device_guid\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"device_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"changed": true,
"content_hash": "<string>",
"last_synced_at": "2023-11-07T05:31:56Z",
"device_updated_at": "2023-11-07T05:31:56Z"
}{
"detail": "<string>",
"code": "error",
"field_errors": [
{
"field": "<string>",
"messages": [
"<string>"
]
}
]
}{
"detail": "<string>",
"code": "error",
"field_errors": [
{
"field": "<string>",
"messages": [
"<string>"
]
}
]
}{
"detail": "<string>",
"code": "error",
"field_errors": [
{
"field": "<string>",
"messages": [
"<string>"
]
}
]
}{
"detail": "<string>",
"code": "error",
"field_errors": [
{
"field": "<string>",
"messages": [
"<string>"
]
}
]
}{
"detail": "<string>",
"code": "error",
"field_errors": [
{
"field": "<string>",
"messages": [
"<string>"
]
}
]
}Inventory
Upsert device inventory projection (internal)
Internal upsert and replay endpoint for inventory device projections.
POST
/
api
/
v1
/
inventory
/
device-projections
/
Upsert device inventory projection (internal)
curl --request POST \
--url https://api.example.com/api/v1/inventory/device-projections/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"netbox_id": 2,
"source_updated_at": "2023-11-07T05:31:56Z",
"bmc_ip": "<string>",
"asset_tag": "",
"description": "",
"custom_fields": {},
"site_netbox_id": 2,
"primary_ip": "<string>",
"device_type_part_number": "<string>",
"device_type_u_height": 123,
"site_description": "<string>",
"site_region": "<string>",
"site_syslog_server": "<string>",
"fru": [
{
"serial_number": "<string>",
"part_number": "<string>",
"model_number": "<string>"
}
],
"interfaces": [
{
"name": "<string>",
"type": "<string>",
"type_display": "<string>",
"ip_addresses": [
"<string>"
],
"mac_address": "<string>",
"ib_device_guid": "<string>"
}
]
}
'import requests
url = "https://api.example.com/api/v1/inventory/device-projections/"
payload = {
"netbox_id": 2,
"source_updated_at": "2023-11-07T05:31:56Z",
"bmc_ip": "<string>",
"asset_tag": "",
"description": "",
"custom_fields": {},
"site_netbox_id": 2,
"primary_ip": "<string>",
"device_type_part_number": "<string>",
"device_type_u_height": 123,
"site_description": "<string>",
"site_region": "<string>",
"site_syslog_server": "<string>",
"fru": [
{
"serial_number": "<string>",
"part_number": "<string>",
"model_number": "<string>"
}
],
"interfaces": [
{
"name": "<string>",
"type": "<string>",
"type_display": "<string>",
"ip_addresses": ["<string>"],
"mac_address": "<string>",
"ib_device_guid": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
netbox_id: 2,
source_updated_at: '2023-11-07T05:31:56Z',
bmc_ip: '<string>',
asset_tag: '',
description: '',
custom_fields: {},
site_netbox_id: 2,
primary_ip: '<string>',
device_type_part_number: '<string>',
device_type_u_height: 123,
site_description: '<string>',
site_region: '<string>',
site_syslog_server: '<string>',
fru: [{serial_number: '<string>', part_number: '<string>', model_number: '<string>'}],
interfaces: [
{
name: '<string>',
type: '<string>',
type_display: '<string>',
ip_addresses: ['<string>'],
mac_address: '<string>',
ib_device_guid: '<string>'
}
]
})
};
fetch('https://api.example.com/api/v1/inventory/device-projections/', 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/api/v1/inventory/device-projections/",
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([
'netbox_id' => 2,
'source_updated_at' => '2023-11-07T05:31:56Z',
'bmc_ip' => '<string>',
'asset_tag' => '',
'description' => '',
'custom_fields' => [
],
'site_netbox_id' => 2,
'primary_ip' => '<string>',
'device_type_part_number' => '<string>',
'device_type_u_height' => 123,
'site_description' => '<string>',
'site_region' => '<string>',
'site_syslog_server' => '<string>',
'fru' => [
[
'serial_number' => '<string>',
'part_number' => '<string>',
'model_number' => '<string>'
]
],
'interfaces' => [
[
'name' => '<string>',
'type' => '<string>',
'type_display' => '<string>',
'ip_addresses' => [
'<string>'
],
'mac_address' => '<string>',
'ib_device_guid' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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/api/v1/inventory/device-projections/"
payload := strings.NewReader("{\n \"netbox_id\": 2,\n \"source_updated_at\": \"2023-11-07T05:31:56Z\",\n \"bmc_ip\": \"<string>\",\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"custom_fields\": {},\n \"site_netbox_id\": 2,\n \"primary_ip\": \"<string>\",\n \"device_type_part_number\": \"<string>\",\n \"device_type_u_height\": 123,\n \"site_description\": \"<string>\",\n \"site_region\": \"<string>\",\n \"site_syslog_server\": \"<string>\",\n \"fru\": [\n {\n \"serial_number\": \"<string>\",\n \"part_number\": \"<string>\",\n \"model_number\": \"<string>\"\n }\n ],\n \"interfaces\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"type_display\": \"<string>\",\n \"ip_addresses\": [\n \"<string>\"\n ],\n \"mac_address\": \"<string>\",\n \"ib_device_guid\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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/api/v1/inventory/device-projections/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"netbox_id\": 2,\n \"source_updated_at\": \"2023-11-07T05:31:56Z\",\n \"bmc_ip\": \"<string>\",\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"custom_fields\": {},\n \"site_netbox_id\": 2,\n \"primary_ip\": \"<string>\",\n \"device_type_part_number\": \"<string>\",\n \"device_type_u_height\": 123,\n \"site_description\": \"<string>\",\n \"site_region\": \"<string>\",\n \"site_syslog_server\": \"<string>\",\n \"fru\": [\n {\n \"serial_number\": \"<string>\",\n \"part_number\": \"<string>\",\n \"model_number\": \"<string>\"\n }\n ],\n \"interfaces\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"type_display\": \"<string>\",\n \"ip_addresses\": [\n \"<string>\"\n ],\n \"mac_address\": \"<string>\",\n \"ib_device_guid\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/inventory/device-projections/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"netbox_id\": 2,\n \"source_updated_at\": \"2023-11-07T05:31:56Z\",\n \"bmc_ip\": \"<string>\",\n \"asset_tag\": \"\",\n \"description\": \"\",\n \"custom_fields\": {},\n \"site_netbox_id\": 2,\n \"primary_ip\": \"<string>\",\n \"device_type_part_number\": \"<string>\",\n \"device_type_u_height\": 123,\n \"site_description\": \"<string>\",\n \"site_region\": \"<string>\",\n \"site_syslog_server\": \"<string>\",\n \"fru\": [\n {\n \"serial_number\": \"<string>\",\n \"part_number\": \"<string>\",\n \"model_number\": \"<string>\"\n }\n ],\n \"interfaces\": [\n {\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"type_display\": \"<string>\",\n \"ip_addresses\": [\n \"<string>\"\n ],\n \"mac_address\": \"<string>\",\n \"ib_device_guid\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"device_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"changed": true,
"content_hash": "<string>",
"last_synced_at": "2023-11-07T05:31:56Z",
"device_updated_at": "2023-11-07T05:31:56Z"
}{
"detail": "<string>",
"code": "error",
"field_errors": [
{
"field": "<string>",
"messages": [
"<string>"
]
}
]
}{
"detail": "<string>",
"code": "error",
"field_errors": [
{
"field": "<string>",
"messages": [
"<string>"
]
}
]
}{
"detail": "<string>",
"code": "error",
"field_errors": [
{
"field": "<string>",
"messages": [
"<string>"
]
}
]
}{
"detail": "<string>",
"code": "error",
"field_errors": [
{
"field": "<string>",
"messages": [
"<string>"
]
}
]
}{
"detail": "<string>",
"code": "error",
"field_errors": [
{
"field": "<string>",
"messages": [
"<string>"
]
}
]
}Authorizations
oauth2cookieAuth
The access token received from the authorization server in the OAuth 2.0 flow.
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
Write contract for the inventory projection upsert endpoint.
netbox_id is the lookup key the server resolves to a Fleet Manager
device. custom_fields carries raw NetBox custom-field values (the read
API stringifies them); the write contract preserves them as-is.
Required range:
x >= 1Show child attributes
Show child attributes
Required range:
x >= 1Show child attributes
Show child attributes
Show child attributes
Show child attributes