![]()
Creating custom Web API endpoints in Power Pages allows you to expose custom logic and data from Microsoft Dataverse to portal users via secure and controlled REST APIs. This is especially useful when building advanced, dynamic, or integrated user experiences beyond the out-of-the-box Entity Lists or Entity Forms.
What Are Custom Web API Endpoints?
Custom APIs in Dataverse (also known as Custom Actions with the Web API enabled) can be exposed to Power Pages. These APIs are designed using Dataverse’s Custom API feature and provide:
- Custom business logic (code or logic workflows)
- RESTful access via Dataverse Web API
- Secure, role-based invocation
Steps to Create Custom Web API Endpoints in Power Pages
Step 1: Create a Custom API in Dataverse
- Go to Power Apps > Dataverse > Tables > Custom APIs.
- Click New Custom API.
- Fill in the required properties:
- Name: Unique logical name
- Display Name: Friendly name
- Binding Type: Global or Entity bound
- Is Private: No (to expose it)
- AllowedCustomProcessingStepType: All or Sync
- Define Request Parameters and Response Properties if needed.
Step 2: Add Plugin Logic (Optional)
If your API requires backend logic:
- Write a custom plugin in C#.
- Register it using the Plugin Registration Tool.
- Associate it with your Custom API’s Main Operation.
Step 3: Enable the Custom API for the Portal
- Ensure that:
IsPrivateis set to false- Your plugin is registered correctly
- Add table permissions to allow calling this API via Web API.
- Use Web Roles to secure access.
Step 4: Call the Custom API from Power Pages (JavaScript)
Use JavaScript with fetch() or XMLHttpRequest to invoke the API:
fetch("/_api/my_customapi_name", {
method: "POST",
headers: {
"Content-Type": "application/json",
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json"
},
body: JSON.stringify({
myparameter1: "value",
myparameter2: 123
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));
Replace
my_customapi_nameand parameters with your actual API names and data.
Security Considerations
- Use Web Roles and Table Permissions to restrict access.
- APIs should only expose non-sensitive logic to anonymous or external users.
- Always validate and sanitize inputs in backend logic.
Testing Your Custom API
- Use Browser Dev Tools, Postman, or Fiddler to test API calls.
- Ensure proper authentication headers are passed if using authenticated endpoints.
Use Cases
- Submitting custom form data
- Triggering workflows or Power Automate flows
- Returning filtered datasets
- Integrating with external systems via plugins
