Custom entity
Custom entities refer to data structures or objects that are not part of the standard schema or predefined models provided by an API. These entities are specifically tailored to meet the unique requirements of individual applications or organizations. Custom entities typically represent specific business entities, such as products, orders, customers, or any other domain-specific entities relevant to the application's functionality. They are defined by developers or administrators within the API's ecosystem and are used to store and manipulate data that is not adequately represented by the API's predefined models.
Adeptia introduces the following configuration within the Open API extensions to specify the custom entities within the API system.
It provides settings for managing and interacting with custom entities in the context of an API, including retrieving the list of entities, specifying their attributes, and defining trigger operations based on certain conditions.
Extension: Custom Entities
| Field name | Description | YAML |
|---|---|---|
| customEntities | Top-level key indicating custom entities configuration | <ch:codesample></ch:codesample> |
| operationId | Identifier for the operation to retrieve the list of custom entities | <ch:codesample></ch:codesample> |
| entityListPath | JSONPath expression to locate custom entities within the API response | <ch:codesample></ch:codesample> |
| nameField | Field name representing the name of the custom entity | <ch:codesample></ch:codesample> |
| descriptionField | Field name representing the description or label of the custom entity | <ch:codesample></ch:codesample> |
| triggerOperations | Object containing trigger operations for different scenarios new: The condition for the new entity trigger for the entity new or updated: The condition for the new or updated entity trigger for the entity updated: The condition for the updated entity trigger for the entity all: The condition for fetching all the entities records for the entity get: The condition for the Get entity trigger for the entity | <ch:codesample></ch:codesample> |
Example: Custom Entities definition for Salesforce Application
Where,
-
operationId: Specifies the operation ID for retrieving the list of custom entities, set to 'getEntitiesList'. -
entityListPath: Defines the JSONPath expression used to locate custom entities within the API response. In this configuration, it searches for entities where the 'custom' attribute is set to true under the 'sobjects' array. -
nameField: Specifies the field name used to represent the name of the custom entity, set to 'name'. -
descriptionField: Specifies the field name used to represent the description or label of the custom entity, set to 'label'. -
triggerOperations: Defines trigger operations for different scenarios:new,newOrUpdated,updated,all, andget: Each operation has a condition associated with it, specified using JSONPath expressions. These conditions determine which custom entities trigger the respective operation based on their attributes. In this configuration, the condition checks if the entity is queryable (i.e., can be queried) and defines the triggers accordingly.