Create Custom API, Binding Type - Entity in Power Apps with XrmToolBox
This blog explores building custom APIs within Power Apps by leveraging plugins. Custom APIs empower developers to expose specific functionalities of Dynamics 365, enabling seamless integration with external systems and services.
Scenario: We will develop a Custom API of Binding type - Entity with a plugin to retrieve records for any specific entity name from Dynamics 365. Subsequently, we'll establish this Custom API, associate it with the registered plugin, and demonstrate how to invoke the API using either the XrmToolBox custom API tester or Power Automate Flow.
Refer to this video for a detailed implementation guide for Developing, Configuring and Invoking Custom API
Custom API Binding Types
In Power Apps, custom APIs offer a flexible way to extend the capabilities of your data platform by defining custom messages that can be invoked from various sources. These messages can interact with data or perform custom logic. A key aspect of custom APIs is the concept of binding types, which determine how the API interacts with entities in your Dataverse environment.
Here's a breakdown of the three available binding types and we will focus on the implementation for the Entity type:
Global:
- Description: This type is most versatile as it doesn't have a specific association with any entity. It's suitable for operations that don't directly work with entity records.
- Use Cases:
- Performing calculations or manipulations on data that doesn't reside in a particular entity.
- Triggering workflows or custom actions that aren't tied to an entity.
- Integrating with external services or systems that don't map directly to Dataverse entities.
Entity:
- Description: This type binds the custom API to a specific entity (table) in Dataverse. It's designed for operations that accept a single record of that entity as input or return information about a single record.
- Use Cases:
- Performing operations on a single entity record, such as creating, updating, or deleting a record.
- Validating data against entity-specific rules before processing it further.
- Retrieving details about a specific entity record.
EntityCollection:
- Description: This type also binds to a specific entity, but it's used for operations that involve collections of records from that entity. It can accept a collection of entity records as input or return a collection of records as output.
- Use Cases:
- Performing bulk operations on multiple entity records, such as creating, updating, or deleting multiple records at once.
- Querying and retrieving a collection of entity records based on specific criteria.
- Power Apps License
- XrmToolBox with Custom API Manager and Custom API Tester installed
- Power Automate License (Optional to Invoke)
- Plugin/C# Development Knowledge
- Visual Studio (with .Net Framework 4.6.2 for plugin development)
- Plugin Registration Tool
Creating a Custom API in Custom API Manager
Plugin Code-
Link to download the plugin code for Entity Type - here
No comments:
Post a Comment