Skip to main content
PUT
/
metadata
/
{resourceId}
Update a metadata object
curl --request PUT \
  --url https://v1.api.altostrat.io/metadata/{resourceId} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "type": "mikrotik.device",
  "metadata": {
    "location": "Level 5, Server Room B",
    "contact_person": "jane.doe@example.com",
    "maintenance_window": null
  }
}
'
import requests

url = "https://v1.api.altostrat.io/metadata/{resourceId}"

payload = {
    "type": "mikrotik.device",
    "metadata": {
        "location": "Level 5, Server Room B",
        "contact_person": "jane.doe@example.com",
        "maintenance_window": None
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    type: 'mikrotik.device',
    metadata: {
      location: 'Level 5, Server Room B',
      contact_person: 'jane.doe@example.com',
      maintenance_window: null
    }
  })
};

fetch('https://v1.api.altostrat.io/metadata/{resourceId}', 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://v1.api.altostrat.io/metadata/{resourceId}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => json_encode([
    'type' => 'mikrotik.device',
    'metadata' => [
        'location' => 'Level 5, Server Room B',
        'contact_person' => 'jane.doe@example.com',
        'maintenance_window' => null
    ]
  ]),
  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://v1.api.altostrat.io/metadata/{resourceId}"

	payload := strings.NewReader("{\n  \"type\": \"mikrotik.device\",\n  \"metadata\": {\n    \"location\": \"Level 5, Server Room B\",\n    \"contact_person\": \"jane.doe@example.com\",\n    \"maintenance_window\": null\n  }\n}")

	req, _ := http.NewRequest("PUT", 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.put("https://v1.api.altostrat.io/metadata/{resourceId}")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"mikrotik.device\",\n  \"metadata\": {\n    \"location\": \"Level 5, Server Room B\",\n    \"contact_person\": \"jane.doe@example.com\",\n    \"maintenance_window\": null\n  }\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://v1.api.altostrat.io/metadata/{resourceId}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"type\": \"mikrotik.device\",\n  \"metadata\": {\n    \"location\": \"Level 5, Server Room B\",\n    \"contact_person\": \"jane.doe@example.com\",\n    \"maintenance_window\": null\n  }\n}"

response = http.request(request)
puts response.read_body
{
  "resource_id": "9b52d930-f432-4c0a-bac0-4c12dff85544",
  "type": "mikrotik.device",
  "metadata": {
    "circuit_id": "AS12345-XYZ",
    "install_date": "2025-01-15",
    "is_critical": true,
    "rack_units": 2
  }
}
{
  "type": "invalid_request_error",
  "code": "parameter_missing",
  "message": "The 'name' parameter is required for this request.",
  "doc_url": "https://docs.altostrat.io/errors/parameter_missing"
}
{
  "type": "invalid_request_error",
  "code": "parameter_missing",
  "message": "The 'name' parameter is required for this request.",
  "doc_url": "https://docs.altostrat.io/errors/parameter_missing"
}
{
  "type": "invalid_request_error",
  "code": "parameter_missing",
  "message": "The 'name' parameter is required for this request.",
  "doc_url": "https://docs.altostrat.io/errors/parameter_missing"
}

Authorizations

Authorization
string
header
required

A bearer token is required for all API requests.

Path Parameters

resourceId
string<uuid>
required

The unique identifier of the resource whose metadata is being accessed.

Body

application/json

The metadata keys and values to update.

type
string
required

A string identifying the type of the resource.

Example:

"mikrotik.device"

metadata
object
required

An object containing the metadata fields to add or update.

Example:
{
  "location": "Level 5, Server Room B",
  "contact_person": "jane.doe@example.com",
  "maintenance_window": null
}

Response

The metadata was updated successfully.

resource_id
string<uuid>

The unique identifier of the resource this metadata belongs to.

Example:

"9b52d930-f432-4c0a-bac0-4c12dff85544"

type
string

A string identifying the type of the resource.

Example:

"mikrotik.device"

metadata
object

A free-form object containing key-value pairs. Values can be strings, numbers, or booleans.

Example:
{
  "circuit_id": "AS12345-XYZ",
  "install_date": "2025-01-15",
  "is_critical": true,
  "rack_units": 2
}