curl --request PUT \
--url https://api.opal.dev/v1/resources/{resource_id}/configuration-template \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"configuration_template_id": "06851574-e50d-40ca-8c78-f72ae6ab4304"
}
'import requests
url = "https://api.opal.dev/v1/resources/{resource_id}/configuration-template"
payload = { "configuration_template_id": "06851574-e50d-40ca-8c78-f72ae6ab4304" }
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({configuration_template_id: '06851574-e50d-40ca-8c78-f72ae6ab4304'})
};
fetch('https://api.opal.dev/v1/resources/{resource_id}/configuration-template', 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.opal.dev/v1/resources/{resource_id}/configuration-template",
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([
'configuration_template_id' => '06851574-e50d-40ca-8c78-f72ae6ab4304'
]),
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.opal.dev/v1/resources/{resource_id}/configuration-template"
payload := strings.NewReader("{\n \"configuration_template_id\": \"06851574-e50d-40ca-8c78-f72ae6ab4304\"\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://api.opal.dev/v1/resources/{resource_id}/configuration-template")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"configuration_template_id\": \"06851574-e50d-40ca-8c78-f72ae6ab4304\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.opal.dev/v1/resources/{resource_id}/configuration-template")
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 \"configuration_template_id\": \"06851574-e50d-40ca-8c78-f72ae6ab4304\"\n}"
response = http.request(request)
puts response.read_body{
"configuration_template_id": "06851574-e50d-40ca-8c78-f72ae6ab4304"
}Set the ID of the configuration template linked to a resource
Attaches, repoints, or detaches the configuration template linked to a
resource. This endpoint only manages the link (by ID) between a
resource and an existing configuration template — it does not create,
modify, or delete the template itself. To manage a template’s own
fields (name, description, request configurations, visibility, etc.),
use the /configuration-templates endpoints.
The request body is {"configuration_template_id": "<uuid>" | null}:
- A
<uuid>value links the resource to the configuration template with that ID. If the resource was previously linked to a different template, the resource is repointed in place. nulldetaches the resource from its current configuration template. The template is deep-copied into a new private configuration with the same settings so the resource’s current behaviour is preserved, and the resource is repointed at the fork.
The configuration_template_id field is required. Sending {} or any
body in which the field is omitted is rejected with 400.
The call is idempotent: if the request body matches the resource’s current link, no changes are made and no audit events are emitted.
This endpoint is the preferred, Terraform-friendly surface for linking
and unlinking configuration templates on resources. The equivalent
configuration_template_id field on PUT /resources remains available
but is deprecated for this purpose.
curl --request PUT \
--url https://api.opal.dev/v1/resources/{resource_id}/configuration-template \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"configuration_template_id": "06851574-e50d-40ca-8c78-f72ae6ab4304"
}
'import requests
url = "https://api.opal.dev/v1/resources/{resource_id}/configuration-template"
payload = { "configuration_template_id": "06851574-e50d-40ca-8c78-f72ae6ab4304" }
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({configuration_template_id: '06851574-e50d-40ca-8c78-f72ae6ab4304'})
};
fetch('https://api.opal.dev/v1/resources/{resource_id}/configuration-template', 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.opal.dev/v1/resources/{resource_id}/configuration-template",
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([
'configuration_template_id' => '06851574-e50d-40ca-8c78-f72ae6ab4304'
]),
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.opal.dev/v1/resources/{resource_id}/configuration-template"
payload := strings.NewReader("{\n \"configuration_template_id\": \"06851574-e50d-40ca-8c78-f72ae6ab4304\"\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://api.opal.dev/v1/resources/{resource_id}/configuration-template")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"configuration_template_id\": \"06851574-e50d-40ca-8c78-f72ae6ab4304\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.opal.dev/v1/resources/{resource_id}/configuration-template")
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 \"configuration_template_id\": \"06851574-e50d-40ca-8c78-f72ae6ab4304\"\n}"
response = http.request(request)
puts response.read_body{
"configuration_template_id": "06851574-e50d-40ca-8c78-f72ae6ab4304"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The ID of the resource whose configuration template link is being set.
Body
A reference, by ID only, to the configuration template a resource is
linked to. This schema does not include any of the template's own
fields (name, description, request configurations, visibility, etc.) —
to read or modify those, use the /configuration-templates endpoints
with the ID carried here. A null configuration_template_id
indicates that the resource is not linked to a configuration template
and uses its own private configuration.
The ID of the configuration template that the resource is linked
to, or null if the resource is not linked to a configuration
template. Only the ID is exposed here; the template's own fields
are managed through the /configuration-templates endpoints.
"06851574-e50d-40ca-8c78-f72ae6ab4304"
Response
The ID of the configuration template now linked to the resource, or null if the resource was detached.
A reference, by ID only, to the configuration template a resource is
linked to. This schema does not include any of the template's own
fields (name, description, request configurations, visibility, etc.) —
to read or modify those, use the /configuration-templates endpoints
with the ID carried here. A null configuration_template_id
indicates that the resource is not linked to a configuration template
and uses its own private configuration.
The ID of the configuration template that the resource is linked
to, or null if the resource is not linked to a configuration
template. Only the ID is exposed here; the template's own fields
are managed through the /configuration-templates endpoints.
"06851574-e50d-40ca-8c78-f72ae6ab4304"
Was this page helpful?