curl --request POST \
--url https://api.getcortexapp.com/api/v1/relationship-types \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
"{\n \"name\": \"Component Hierarchy\",\n \"tag\": \"component-hierarchy\",\n \"description\": \"Defines the component hierarchy.\",\n \"definitionLocation\": \"BOTH\",\n \"isSingleSource\": true,\n \"sourcesFilter\": {\n \"include\": true,\n \"types\": [\"component\"]\n },\n \"isSingleDestination\": false,\n \"destinationsFilter\": {\n \"include\": true,\n \"types\": [\"service\", \"component]\n },\n \"inheritances\": [\n {\n \"parameterTag\": \"x-cortex-owners\",\n \"inheritanceType\": \"FALLBACK\"\n }\n ],\n \"allowCycles\": false,\n \"sourceLabelSingular\": \"Component\",\n \"sourceLabelPlural\": \"Components\",\n \"destinationLabelSingular\": \"Part\",\n \"destinationLabelPlural\": \"Parts\",\n \"createCatalog\": false\n }"
'import requests
url = "https://api.getcortexapp.com/api/v1/relationship-types"
payload = "{
\"name\": \"Component Hierarchy\",
\"tag\": \"component-hierarchy\",
\"description\": \"Defines the component hierarchy.\",
\"definitionLocation\": \"BOTH\",
\"isSingleSource\": true,
\"sourcesFilter\": {
\"include\": true,
\"types\": [\"component\"]
},
\"isSingleDestination\": false,
\"destinationsFilter\": {
\"include\": true,
\"types\": [\"service\", \"component]
},
\"inheritances\": [
{
\"parameterTag\": \"x-cortex-owners\",
\"inheritanceType\": \"FALLBACK\"
}
],
\"allowCycles\": false,
\"sourceLabelSingular\": \"Component\",
\"sourceLabelPlural\": \"Components\",
\"destinationLabelSingular\": \"Part\",
\"destinationLabelPlural\": \"Parts\",
\"createCatalog\": false
}"
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('{\n "name": "Component Hierarchy",\n "tag": "component-hierarchy",\n "description": "Defines the component hierarchy.",\n "definitionLocation": "BOTH",\n "isSingleSource": true,\n "sourcesFilter": {\n "include": true,\n "types": ["component"]\n },\n "isSingleDestination": false,\n "destinationsFilter": {\n "include": true,\n "types": ["service", "component]\n },\n "inheritances": [\n {\n "parameterTag": "x-cortex-owners",\n "inheritanceType": "FALLBACK"\n }\n ],\n "allowCycles": false,\n "sourceLabelSingular": "Component",\n "sourceLabelPlural": "Components",\n "destinationLabelSingular": "Part",\n "destinationLabelPlural": "Parts",\n "createCatalog": false\n }')
};
fetch('https://api.getcortexapp.com/api/v1/relationship-types', 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.getcortexapp.com/api/v1/relationship-types",
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('{
"name": "Component Hierarchy",
"tag": "component-hierarchy",
"description": "Defines the component hierarchy.",
"definitionLocation": "BOTH",
"isSingleSource": true,
"sourcesFilter": {
"include": true,
"types": ["component"]
},
"isSingleDestination": false,
"destinationsFilter": {
"include": true,
"types": ["service", "component]
},
"inheritances": [
{
"parameterTag": "x-cortex-owners",
"inheritanceType": "FALLBACK"
}
],
"allowCycles": false,
"sourceLabelSingular": "Component",
"sourceLabelPlural": "Components",
"destinationLabelSingular": "Part",
"destinationLabelPlural": "Parts",
"createCatalog": false
}'),
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.getcortexapp.com/api/v1/relationship-types"
payload := strings.NewReader("\"{\\n \\\"name\\\": \\\"Component Hierarchy\\\",\\n \\\"tag\\\": \\\"component-hierarchy\\\",\\n \\\"description\\\": \\\"Defines the component hierarchy.\\\",\\n \\\"definitionLocation\\\": \\\"BOTH\\\",\\n \\\"isSingleSource\\\": true,\\n \\\"sourcesFilter\\\": {\\n \\\"include\\\": true,\\n \\\"types\\\": [\\\"component\\\"]\\n },\\n \\\"isSingleDestination\\\": false,\\n \\\"destinationsFilter\\\": {\\n \\\"include\\\": true,\\n \\\"types\\\": [\\\"service\\\", \\\"component]\\n },\\n \\\"inheritances\\\": [\\n {\\n \\\"parameterTag\\\": \\\"x-cortex-owners\\\",\\n \\\"inheritanceType\\\": \\\"FALLBACK\\\"\\n }\\n ],\\n \\\"allowCycles\\\": false,\\n \\\"sourceLabelSingular\\\": \\\"Component\\\",\\n \\\"sourceLabelPlural\\\": \\\"Components\\\",\\n \\\"destinationLabelSingular\\\": \\\"Part\\\",\\n \\\"destinationLabelPlural\\\": \\\"Parts\\\",\\n \\\"createCatalog\\\": false\\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.getcortexapp.com/api/v1/relationship-types")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("\"{\\n \\\"name\\\": \\\"Component Hierarchy\\\",\\n \\\"tag\\\": \\\"component-hierarchy\\\",\\n \\\"description\\\": \\\"Defines the component hierarchy.\\\",\\n \\\"definitionLocation\\\": \\\"BOTH\\\",\\n \\\"isSingleSource\\\": true,\\n \\\"sourcesFilter\\\": {\\n \\\"include\\\": true,\\n \\\"types\\\": [\\\"component\\\"]\\n },\\n \\\"isSingleDestination\\\": false,\\n \\\"destinationsFilter\\\": {\\n \\\"include\\\": true,\\n \\\"types\\\": [\\\"service\\\", \\\"component]\\n },\\n \\\"inheritances\\\": [\\n {\\n \\\"parameterTag\\\": \\\"x-cortex-owners\\\",\\n \\\"inheritanceType\\\": \\\"FALLBACK\\\"\\n }\\n ],\\n \\\"allowCycles\\\": false,\\n \\\"sourceLabelSingular\\\": \\\"Component\\\",\\n \\\"sourceLabelPlural\\\": \\\"Components\\\",\\n \\\"destinationLabelSingular\\\": \\\"Part\\\",\\n \\\"destinationLabelPlural\\\": \\\"Parts\\\",\\n \\\"createCatalog\\\": false\\n }\"")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getcortexapp.com/api/v1/relationship-types")
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 \\\"name\\\": \\\"Component Hierarchy\\\",\\n \\\"tag\\\": \\\"component-hierarchy\\\",\\n \\\"description\\\": \\\"Defines the component hierarchy.\\\",\\n \\\"definitionLocation\\\": \\\"BOTH\\\",\\n \\\"isSingleSource\\\": true,\\n \\\"sourcesFilter\\\": {\\n \\\"include\\\": true,\\n \\\"types\\\": [\\\"component\\\"]\\n },\\n \\\"isSingleDestination\\\": false,\\n \\\"destinationsFilter\\\": {\\n \\\"include\\\": true,\\n \\\"types\\\": [\\\"service\\\", \\\"component]\\n },\\n \\\"inheritances\\\": [\\n {\\n \\\"parameterTag\\\": \\\"x-cortex-owners\\\",\\n \\\"inheritanceType\\\": \\\"FALLBACK\\\"\\n }\\n ],\\n \\\"allowCycles\\\": false,\\n \\\"sourceLabelSingular\\\": \\\"Component\\\",\\n \\\"sourceLabelPlural\\\": \\\"Components\\\",\\n \\\"destinationLabelSingular\\\": \\\"Part\\\",\\n \\\"destinationLabelPlural\\\": \\\"Parts\\\",\\n \\\"createCatalog\\\": false\\n }\""
response = http.request(request)
puts response.read_body{
"allowCycles": false,
"definitionLocation": "BOTH",
"destinationsFilter": {
"include": true,
"providers": [
"AWS"
],
"types": [
"<string>"
]
},
"inheritances": [
{
"inheritanceType": "NONE",
"parameterTag": "<string>"
}
],
"isCortexManaged": false,
"isSingleDestination": false,
"isSingleSource": false,
"name": "Component Hierarchy",
"sourcesFilter": {
"include": true,
"providers": [
"AWS"
],
"types": [
"<string>"
]
},
"tag": "component-hierarchy",
"description": "Defines the component hierarchy",
"destinationLabelPlural": "Parts",
"destinationLabelSingular": "Part",
"destinationNamePlural": "<string>",
"destinationNameSingular": "<string>",
"sourceLabelPlural": "Components",
"sourceLabelSingular": "Component",
"sourceNamePlural": "<string>",
"sourceNameSingular": "<string>"
}{
"message": "<string>",
"type": "INTEGRATION_MISSING",
"details": "<string>",
"errorCode": "<string>",
"gatewayHttpStatus": 123,
"httpStatus": 123,
"requestId": "<string>"
}{
"status": 429,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"instance": "<string>",
"retryAfter": 1
}Create relationship type
Create a relationship type
curl --request POST \
--url https://api.getcortexapp.com/api/v1/relationship-types \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
"{\n \"name\": \"Component Hierarchy\",\n \"tag\": \"component-hierarchy\",\n \"description\": \"Defines the component hierarchy.\",\n \"definitionLocation\": \"BOTH\",\n \"isSingleSource\": true,\n \"sourcesFilter\": {\n \"include\": true,\n \"types\": [\"component\"]\n },\n \"isSingleDestination\": false,\n \"destinationsFilter\": {\n \"include\": true,\n \"types\": [\"service\", \"component]\n },\n \"inheritances\": [\n {\n \"parameterTag\": \"x-cortex-owners\",\n \"inheritanceType\": \"FALLBACK\"\n }\n ],\n \"allowCycles\": false,\n \"sourceLabelSingular\": \"Component\",\n \"sourceLabelPlural\": \"Components\",\n \"destinationLabelSingular\": \"Part\",\n \"destinationLabelPlural\": \"Parts\",\n \"createCatalog\": false\n }"
'import requests
url = "https://api.getcortexapp.com/api/v1/relationship-types"
payload = "{
\"name\": \"Component Hierarchy\",
\"tag\": \"component-hierarchy\",
\"description\": \"Defines the component hierarchy.\",
\"definitionLocation\": \"BOTH\",
\"isSingleSource\": true,
\"sourcesFilter\": {
\"include\": true,
\"types\": [\"component\"]
},
\"isSingleDestination\": false,
\"destinationsFilter\": {
\"include\": true,
\"types\": [\"service\", \"component]
},
\"inheritances\": [
{
\"parameterTag\": \"x-cortex-owners\",
\"inheritanceType\": \"FALLBACK\"
}
],
\"allowCycles\": false,
\"sourceLabelSingular\": \"Component\",
\"sourceLabelPlural\": \"Components\",
\"destinationLabelSingular\": \"Part\",
\"destinationLabelPlural\": \"Parts\",
\"createCatalog\": false
}"
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('{\n "name": "Component Hierarchy",\n "tag": "component-hierarchy",\n "description": "Defines the component hierarchy.",\n "definitionLocation": "BOTH",\n "isSingleSource": true,\n "sourcesFilter": {\n "include": true,\n "types": ["component"]\n },\n "isSingleDestination": false,\n "destinationsFilter": {\n "include": true,\n "types": ["service", "component]\n },\n "inheritances": [\n {\n "parameterTag": "x-cortex-owners",\n "inheritanceType": "FALLBACK"\n }\n ],\n "allowCycles": false,\n "sourceLabelSingular": "Component",\n "sourceLabelPlural": "Components",\n "destinationLabelSingular": "Part",\n "destinationLabelPlural": "Parts",\n "createCatalog": false\n }')
};
fetch('https://api.getcortexapp.com/api/v1/relationship-types', 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.getcortexapp.com/api/v1/relationship-types",
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('{
"name": "Component Hierarchy",
"tag": "component-hierarchy",
"description": "Defines the component hierarchy.",
"definitionLocation": "BOTH",
"isSingleSource": true,
"sourcesFilter": {
"include": true,
"types": ["component"]
},
"isSingleDestination": false,
"destinationsFilter": {
"include": true,
"types": ["service", "component]
},
"inheritances": [
{
"parameterTag": "x-cortex-owners",
"inheritanceType": "FALLBACK"
}
],
"allowCycles": false,
"sourceLabelSingular": "Component",
"sourceLabelPlural": "Components",
"destinationLabelSingular": "Part",
"destinationLabelPlural": "Parts",
"createCatalog": false
}'),
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.getcortexapp.com/api/v1/relationship-types"
payload := strings.NewReader("\"{\\n \\\"name\\\": \\\"Component Hierarchy\\\",\\n \\\"tag\\\": \\\"component-hierarchy\\\",\\n \\\"description\\\": \\\"Defines the component hierarchy.\\\",\\n \\\"definitionLocation\\\": \\\"BOTH\\\",\\n \\\"isSingleSource\\\": true,\\n \\\"sourcesFilter\\\": {\\n \\\"include\\\": true,\\n \\\"types\\\": [\\\"component\\\"]\\n },\\n \\\"isSingleDestination\\\": false,\\n \\\"destinationsFilter\\\": {\\n \\\"include\\\": true,\\n \\\"types\\\": [\\\"service\\\", \\\"component]\\n },\\n \\\"inheritances\\\": [\\n {\\n \\\"parameterTag\\\": \\\"x-cortex-owners\\\",\\n \\\"inheritanceType\\\": \\\"FALLBACK\\\"\\n }\\n ],\\n \\\"allowCycles\\\": false,\\n \\\"sourceLabelSingular\\\": \\\"Component\\\",\\n \\\"sourceLabelPlural\\\": \\\"Components\\\",\\n \\\"destinationLabelSingular\\\": \\\"Part\\\",\\n \\\"destinationLabelPlural\\\": \\\"Parts\\\",\\n \\\"createCatalog\\\": false\\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.getcortexapp.com/api/v1/relationship-types")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("\"{\\n \\\"name\\\": \\\"Component Hierarchy\\\",\\n \\\"tag\\\": \\\"component-hierarchy\\\",\\n \\\"description\\\": \\\"Defines the component hierarchy.\\\",\\n \\\"definitionLocation\\\": \\\"BOTH\\\",\\n \\\"isSingleSource\\\": true,\\n \\\"sourcesFilter\\\": {\\n \\\"include\\\": true,\\n \\\"types\\\": [\\\"component\\\"]\\n },\\n \\\"isSingleDestination\\\": false,\\n \\\"destinationsFilter\\\": {\\n \\\"include\\\": true,\\n \\\"types\\\": [\\\"service\\\", \\\"component]\\n },\\n \\\"inheritances\\\": [\\n {\\n \\\"parameterTag\\\": \\\"x-cortex-owners\\\",\\n \\\"inheritanceType\\\": \\\"FALLBACK\\\"\\n }\\n ],\\n \\\"allowCycles\\\": false,\\n \\\"sourceLabelSingular\\\": \\\"Component\\\",\\n \\\"sourceLabelPlural\\\": \\\"Components\\\",\\n \\\"destinationLabelSingular\\\": \\\"Part\\\",\\n \\\"destinationLabelPlural\\\": \\\"Parts\\\",\\n \\\"createCatalog\\\": false\\n }\"")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getcortexapp.com/api/v1/relationship-types")
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 \\\"name\\\": \\\"Component Hierarchy\\\",\\n \\\"tag\\\": \\\"component-hierarchy\\\",\\n \\\"description\\\": \\\"Defines the component hierarchy.\\\",\\n \\\"definitionLocation\\\": \\\"BOTH\\\",\\n \\\"isSingleSource\\\": true,\\n \\\"sourcesFilter\\\": {\\n \\\"include\\\": true,\\n \\\"types\\\": [\\\"component\\\"]\\n },\\n \\\"isSingleDestination\\\": false,\\n \\\"destinationsFilter\\\": {\\n \\\"include\\\": true,\\n \\\"types\\\": [\\\"service\\\", \\\"component]\\n },\\n \\\"inheritances\\\": [\\n {\\n \\\"parameterTag\\\": \\\"x-cortex-owners\\\",\\n \\\"inheritanceType\\\": \\\"FALLBACK\\\"\\n }\\n ],\\n \\\"allowCycles\\\": false,\\n \\\"sourceLabelSingular\\\": \\\"Component\\\",\\n \\\"sourceLabelPlural\\\": \\\"Components\\\",\\n \\\"destinationLabelSingular\\\": \\\"Part\\\",\\n \\\"destinationLabelPlural\\\": \\\"Parts\\\",\\n \\\"createCatalog\\\": false\\n }\""
response = http.request(request)
puts response.read_body{
"allowCycles": false,
"definitionLocation": "BOTH",
"destinationsFilter": {
"include": true,
"providers": [
"AWS"
],
"types": [
"<string>"
]
},
"inheritances": [
{
"inheritanceType": "NONE",
"parameterTag": "<string>"
}
],
"isCortexManaged": false,
"isSingleDestination": false,
"isSingleSource": false,
"name": "Component Hierarchy",
"sourcesFilter": {
"include": true,
"providers": [
"AWS"
],
"types": [
"<string>"
]
},
"tag": "component-hierarchy",
"description": "Defines the component hierarchy",
"destinationLabelPlural": "Parts",
"destinationLabelSingular": "Part",
"destinationNamePlural": "<string>",
"destinationNameSingular": "<string>",
"sourceLabelPlural": "Components",
"sourceLabelSingular": "Component",
"sourceNamePlural": "<string>",
"sourceNameSingular": "<string>"
}{
"message": "<string>",
"type": "INTEGRATION_MISSING",
"details": "<string>",
"errorCode": "<string>",
"gatewayHttpStatus": 123,
"httpStatus": 123,
"requestId": "<string>"
}{
"status": 429,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"instance": "<string>",
"retryAfter": 1
}Authorizations
All requests to the Cortex API need to provide an Authorization: Bearer <token> header, where <token> is an API key created in the Settings page of your workspace.
Body
Request to create or update a relationship type
Whether cyclical relationships are allowed
false
Whether to create a catalog page for this relationship type
false
Defines where a relationship can be configured in entity descriptors
SOURCE, DESTINATION, BOTH "BOTH"
Show child attributes
Show child attributes
Inheritance configuration for Cortex parameters. Currently supports ownership inheritance via x-cortex-owners.
Show child attributes
Show child attributes
Whether an entity can have only one destination for this relationship type
false
Whether an entity can have only one source for this relationship type
false
Human-readable name for the relationship type
"Component Hierarchy"
Show child attributes
Show child attributes
Unique identifier tag for the relationship type
"component-hierarchy"
Optional description explaining the relationship type
"Defines the component hierarchy"
Plural label for destinations in the relationship
"Parts"
Singular label for destinations in the relationship
"Part"
Plural label for sources in the relationship
"Components"
Singular label for sources in the relationship
"Component"
Response
Successfully created relationship type
Response containing relationship type details
Whether cyclical relationships are allowed
false
Defines where a relationship can be configured in entity descriptors
SOURCE, DESTINATION, BOTH "BOTH"
Show child attributes
Show child attributes
Inheritance configuration for Cortex parameters. Currently supports ownership inheritance via x-cortex-owners.
Show child attributes
Show child attributes
Whether this relationship type is managed by Cortex
false
Whether an entity can have only one destination for this relationship type
false
Whether an entity can have only one source for this relationship type
false
Human-readable name for the relationship type
"Component Hierarchy"
Show child attributes
Show child attributes
Unique identifier tag for the relationship type
"component-hierarchy"
Optional description explaining the relationship type
"Defines the component hierarchy"
Plural label for destinations in the relationship
"Parts"
Singular label for destinations in the relationship
"Part"
Plural label for sources in the relationship
"Components"
Singular label for sources in the relationship
"Component"