catalog.relations.create
Create a new relation definition between two entity types.
Allowed type values are: consumes, depends on, parent of, part of, provides, and manages. Allowed cardinality values are: one_to_one, one_to_many, many_to_one, and many_to_many.
The relation identifier must contain only letters, numbers, underscores, periods, and hyphens, and must be unique within your account.
Once the relations are defined, use the catalog.relationEdges.* methods to add and remove edges between specific entities.
Facts
| Method | POST https://api.getdx.com/catalog.relations.create |
| Required scope | catalog:write:entities |
Arguments
Required arguments
| Name | Type | Description |
|---|---|---|
token |
Token |
Auth token passed as an HTTP header. |
identifier |
Text |
Unique identifier for this relation definition within the source entity type. |
source_entity_type_identifier |
Text |
Identifier of the entity type that acts as the source side of the relation. |
target_entity_type_identifier |
Text |
Identifier of the entity type that acts as the target side of the relation. |
type |
Text |
One of the standard relation types (see introduction above). |
cardinality |
Text |
One of one_to_one, one_to_many, many_to_one, or many_to_many. |
Optional arguments
| Name | Type | Description |
|---|---|---|
description |
Text |
Human-readable description. |
Example request
This is a typical request:
curl -X POST https://api.getdx.com/catalog.relations.create \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer xxxx-xxxxxxxxx-xxxx' \
--data '{
"identifier": "service-depends-on-service",
"source_entity_type_identifier": "service",
"target_entity_type_identifier": "service",
"type": "depends on",
"cardinality": "many_to_many",
"description": "Service depends on service"
}'
Example response
This is a typical success response:
{
"ok": true,
"relation": {
"identifier": "service-depends-on-service",
"type": "depends on",
"inverse_type": "dependency of",
"cardinality": "many_to_many",
"description": "Service depends on service",
"source_entity_type_identifier": "service",
"target_entity_type_identifier": "service",
"created_at": "2025-01-02T20:48:45.77969Z",
"updated_at": "2025-01-02T20:48:45.77969Z"
}
}
Errors
This table lists the expected errors that this method could return. However, other errors can be returned in the case where the service is down or other unexpected factors affect processing. Callers should always check the value of the ok param in the response.
| Error | Description |
|---|---|
not_authed |
No authentication token provided. |
invalid_auth |
Some aspect of authentication cannot be validated. |
invalid_arguments |
One or more arguments are invalid or violate format or enum constraints. |
not_found |
Referenced entity type identifier does not exist. |