Introduction
Custom APIs offer a new code-first way to define messages that you can add to Dataverse web services. Conceptually, Custom APIs are an extension to Custom Actions that have provided a no-code way to include custom messages.
Custom API is a new feature introduced by Microsoft which is similar to Custom Action with few enhancements. Custom API can be used to Create Service in Dataverse which can be consumed from Web API, C#, OOB Classic Workflow & Web resource Javascript. Custom API can be integrated with External system to perform CRUD operation.
Data types supported for Custom API Request Parameters and Response properties
The data type of the custom API request parameter.
- Boolean
- DateTime
- Decimal
- Entity
- EntityCollection
- EntityReference
- Float
- Integer
- Money
- Picklist
- String
- StringArray
- Guid
Key Points
- Classic interface can be used to create Custom Action. Future release will have UCI support and nice UI to create/customize Custom Action
- Custom API can be tested using Rest Builder Tool
- Debugging of Custom API code is possible by registering plugin steps on Custom API Message on Post operation
Step 1 - Create new Custom API
Navigate to make.powerapps.com and create a new solution or open any existing solution-> Click on New and Select Custom API-> Enter below details and click on Save.
Key Points to consider while creating new Custom API record
- Unique Name should be prefixed with solution publisher prefix
- Binding Type can be Global, Entity and EntityCollection. Please note EntityCollection is only Supported for Function
- Provide Bound Entity Logical Name when you select Binding Type as Entity and EntityCollection
- Is Function should be set to No when you are creating Custom Action which can be called as Post else set No to create Custom Function which can be invoked using Get request
- Allow Custom Processing Step Type set this is None if you don't want to allow any Post and Pre operation logic to be added. When you select None message name will not appear in Plugin Registration tool while registering the steps
- While Custom API has an Execute Privilege Name (
ExecutePrivilegeName
) property, there is currently no supported way for you to create a new privilege just for this API. This is planned for a future release. In the meantime, there are two options:
- You can use an existing Privilege.Name value.
- You can create a custom entity and use one of the privileges created for that entity. For example, create an entity named
new_myaction
and privileges for CRUD operations will be generated for it. For example prvCreatenew_myaction
. You will need to include this custom entity with the solution that includes the Custom API.
Step 2
Create Custom API Request Parametes
Go to Solution and Click on New+ and select Custom API Request Parameter and provide details as below
Key Points
The primary name of the request parameter. This will display in the list of custom api request parameters when viewed in the solution. Use this to differentiate this parameter from others that share a common Unique Name. This naming convention is recommended: {Custom API Unique Name}.{Parameter UniqueName}
Step 3
Create Custom API Response Property
Navigate to Solution and click on New+->Select Custom API Response Property and provide details as shown below
Conclusion
We have created our Custom API records. In the next blog we will write plugin .Net code on Custom API.
Custom API has great features and flexibility as compared to Custom Action. One of the key features is to prevent executing Custom API based on existing Privilege which was not possible through Custom Action. One of the other key feature is to create service as Get Request which can be used for many real-world use cases.
Custom API is a new feature introduced by Microsoft which is similar to Custom Action with few enhancements. Custom API can be used to Create Service in Dataverse which can be consumed from Web API, C#, OOB Classic Workflow & Web resource Javascript. Custom API can be integrated with External
Hope this helps!