Relationships
Relationships between entities reflect how data models interact with each other, similar to relationships between tables in a relational database.
Last updated
Relationships between entities reflect how data models interact with each other, similar to relationships between tables in a relational database.
Last updated
Types of Relationships:
One-to-One: A relationship where a single record in one entity is associated with a single record in another. For instance, a user and a user profile.
One-to-Many: A common relationship where a record from one entity can be associated with multiple records in another. For example, a single customer having multiple orders.
Many-to-Many: This involves two entities that can have multiple records related to multiple records in the other entity. Many-to-many relationships often require a join table or entity.
Defining Relationships: When defining a relationship, select the type of relationship, specify the related entities, and if necessary, define the join entity for many-to-many relationships.
In API Builder, by March 7, 2024 we have implemented support for creating "one-to-many" relationships between entities. This type of relationship allows one entity to be associated with multiple records of another entity, widely used for modeling hierarchical and related data in applications.
Select the Target Entity: In the API Builder interface, select the entity for which you want to create a relationship. (target reference not a source)
Go to Relationships tab
Click 'Add a Relationship' button
Fill out the form
Save the Relationship: After configuring the relationship parameters, save the changes. API Builder will automatically update the entity models and generate the corresponding API endpoints for managing the related data.
For example: In the "Source" field, enter "List". For "Source Reference", enter "List", and for "Target Reference", use "Tasks" (plural). This configuration establishes a "one-to-many" relationship between the "List" and "Task" entities, indicating that one "List" can contain multiple "Tasks".
Source primary and Source optional checks
How to update the Relationship