You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: powerapps-docs/developer/data-platform/custom-api.md
+22-10Lines changed: 22 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,17 @@
1
1
---
2
2
title: "Create and use custom APIs (Microsoft Dataverse) | Microsoft Docs"# Intent and product brand in a unique string of 43-59 chars including spaces
3
-
description: "custom API is a code-first way to define custom messages for Microsoft Dataverse"# 115-145 characters including spaces. This abstract displays in the search result.
3
+
description: "Custom API is a code-first way to define custom messages for Microsoft Dataverse"# 115-145 characters including spaces. This abstract displays in the search result.
4
4
author: divkamath
5
5
ms.author: dikamath
6
-
ms.date: 10/18/2023
6
+
ms.date: 02/14/2024
7
7
ms.reviewer: jdaly
8
8
ms.topic: article
9
9
ms.subservice: dataverse-developer
10
10
search.audienceType:
11
11
- developer
12
12
contributors:
13
13
- JimDaly
14
+
- SomaDaDe
14
15
---
15
16
# Create and use custom APIs
16
17
@@ -24,7 +25,7 @@ Custom APIs are an alternative to custom process actions. Custom process actions
24
25
25
26
A custom API can include logic implemented with a plug-in. Using [Microsoft Dataverse business events](business-events.md), you can create a custom API without a plug-in to pass data about an event that other subscribers respond to.
26
27
27
-
However, in other cases you'll combine a custom API with a plug-in to define some operation that is delegated to Dataverse to compute and return the result.
28
+
However, in other cases you combine a custom API with a plug-in to define some operation that is delegated to Dataverse to compute and return the result.
28
29
29
30
There are several different ways to create a custom API:
30
31
@@ -64,20 +65,20 @@ More information [Managed properties](/power-platform/alm/managed-properties-alm
64
65
65
66
### Add more request parameters and response properties
66
67
67
-
Even when you have set the **Is Customizable** managed property to these components to `false`, new request parameters and response properties can be added to your custom API. However, these request parameters can't be made required. If you choose to allow custom processing steps on your custom API, other plug-ins registered for the message created by your custom API can use them. Because custom request parameters can only be optional, the plug-in you provide for the main operation of the custom API can ignore them and isn't responsible for using any custom request parameters or setting any custom response properties.
68
+
Even when you set the **Is Customizable** managed property to these components to `false`, new request parameters and response properties can be added to your custom API. However, these request parameters can't be made required. If you choose to allow custom processing steps on your custom API, other plug-ins registered for the message created by your custom API can use them. Because custom request parameters can only be optional, the plug-in you provide for the main operation of the custom API can ignore them and isn't responsible for using any custom request parameters or setting any custom response properties.
68
69
69
70
## Custom API tables/entities
70
71
71
-
See [CustomAPI tables](custom-api-tables.md) for information about the tables and column values to use when creating Custom APIs.
72
+
See [CustomAPI tables](custom-api-tables.md) for information about the tables and column values to use when creating custom APIs.
72
73
73
74
74
-
## Select a Custom Processing Step Type
75
+
## Select a custom processing step type
75
76
76
77
The following table describes which custom API **Custom Processing Step Type** (`AllowedCustomProcessingStepType`) you should use.
77
78
78
79
|Option |When to use |
79
80
|---------|---------|
80
-
|**None**|When the plug-in set for this custom API using [CustomAPI.PluginTypeId](reference/entities/customapi.md#BKMK_PluginTypeId) is the only logic that occurs when this operation executes.<br/>You won't allow another developer to register any more steps that can trigger other logic, modify the behavior of this operation, or cancel the operation.<br/>Use this option when the custom API provides some capability that shouldn't be customizable.|
81
+
|**None**|When the plug-in set for this custom API using [CustomAPI.PluginTypeId](reference/entities/customapi.md#BKMK_PluginTypeId) is the only logic that occurs when this operation executes.<br/>You don't allow other developers to register any more steps that can trigger other logic, modify the behavior of this operation, or cancel the operation.<br/>Use this option when the custom API provides some capability that shouldn't be customizable.|
81
82
|**Async Only**|When you want to allow other developers to detect when this operation occurs, but you don't want them to be able to cancel the operation or customize the behavior of the operation.<br/> Other developers can register asynchronous steps to detect that this operation occurred and respond to it after it has completed.<br/>This option is recommended if you're using the business events pattern. A business event creates a trigger in Power Automate to you can use when this event occurs. More information: [Microsoft Dataverse business events](business-events.md)|
82
83
|**Sync and Async**|When you want to allow other developers to have the ability to change the behavior of the operation, and even cancel it if their business logic dictates.<br/>If the operation succeeds, other developers can also detect this event and add logic to run asynchronously.<br/>Most Dataverse messages enable extension in this manner. Use this option when your message represents a business process that should be customizable.|
83
84
@@ -149,7 +150,10 @@ If you don't set the custom API **Plugin Type** (`PluginTypeId`) to specify mai
149
150
150
151
You might choose to not include any logic in the plug-in because you're using the custom API as a business event. More information: [Microsoft Dataverse business events](business-events.md).
151
152
152
-
You might not want to add a plug-in as a testing step. Without a plug-in, any output parameter values return the default values for the type because there's no code to set them.
153
+
You might not want to add a plug-in as a testing step. Without a plug-in, any output parameter values return the default values for the type because there's no code to set them. Otherwise, see [Write a Plug-in for your custom API](#write-a-plug-in-for-your-custom-api)
154
+
155
+
> [!NOTE]
156
+
> You can't pass configuration data to the plug-in specified for the main operation logic. [There is a workaround for this](#secure-and-unsecure-configuration-cant-be-set-for-the-custom-api-main-operation-plug-in).
153
157
154
158
## Use a custom API in a workflow
155
159
@@ -260,7 +264,7 @@ The logic to be performed using a background operation must be defined as a cust
260
264
261
265
## Write a Plug-in for your custom API
262
266
263
-
Writing a plug-in to implement the main operation for your custom API isn't different from writing any other plug-in, except that you don't use the Plug-in Registration tool to set a specific step.
267
+
Writing a plug-in to implement the main operation for your custom API isn't different from writing any other plug-in, except that you don't use the Plug-in Registration tool to set a specific step and [you can't specify configuration data to pass to the plug-in](#secure-and-unsecure-configuration-cant-be-set-for-the-custom-api-main-operation-plug-in).
264
268
265
269
You need to know the following information:
266
270
@@ -465,7 +469,7 @@ More information:
465
469
466
470
## Known issues with custom APIs
467
471
468
-
Custom API is now generally available, but there are still some related capabilities that we expect to change.
472
+
Custom APIs are now generally available, but there are still some related capabilities that we expect to change.
469
473
470
474
### Not able to use profiler for debugging
471
475
@@ -477,6 +481,14 @@ To debug using the Plug-in Registration tool and the Plug-in profiler solution,
477
481
478
482
If you define your custom API to be private, you can't use that message in a plug-in. More information: [Private Messages](org-service/use-messages.md#private-messages)
479
483
484
+
### Secure and unsecure configuration can't be set for the custom API main operation plug-in
485
+
486
+
You can't pass [secure or unsecure configuration](write-plug-in.md#pass-configuration-data-to-your-plug-in) in to the main operation Plugin for the custom API.
487
+
488
+
**Workaround**: Rather than associate the plug-in with the custom API, register the plug-in on the `PostOperation` stage using the Plug-in Registration tool (PRT). This way, you can [specify configuration data in the `PostOperation` plug-in step as you usually do](register-plug-in.md#set-configuration-data).
489
+
490
+
To use this workaround, you must configure your custom API to enable **Sync and Async**[custom processing step types](#select-a-custom-processing-step-type) when you create the custom api. You can't change this after you create it.
491
+
480
492
### Next Steps
481
493
482
494
[Create a custom API using the plug-in registration tool](create-custom-api-prt.md)
0 commit comments