Relationships

Create a relationship definition

Changed on

Creates a new relationship definition between two object types

post/v1/relationships

Request

  • Base URL
    https://app.nex.ai/api/developers
  • Auth
    API key in header Authorization

Request body

type'one_to_one' | 'one_to_many' | 'many_to_many' required

Relationship cardinality

entity_definition_1_idstring required

First object definition ID

entity_definition_2_idstring required

Second object definition ID

entity_1_to_2_predicatestring

Label for 1→2 direction (e.g., 'has')

entity_2_to_1_predicatestring

Label for 2→1 direction (e.g., 'belongs to')

Example request

{
  "type": "one_to_many",
  "entity_definition_1_id": "123",
  "entity_definition_2_id": "456",
  "entity_1_to_2_predicate": "has",
  "entity_2_to_1_predicate": "belongs to"
}

Response

Created relationship definition

idstring
type'one_to_one' | 'one_to_many' | 'many_to_many'
entity_definition_1_idstring
entity_definition_2_idstring
entity_1_to_2_predicatestring
entity_2_to_1_predicatestring
created_atstring date-time

Example response

{
  "id": "789",
  "type": "one_to_many",
  "entity_definition_1_id": "123",
  "entity_definition_2_id": "456",
  "entity_1_to_2_predicate": "has",
  "entity_2_to_1_predicate": "belongs to",
  "created_at": "2024-01-15T10:00:00Z"
}

Changes