Hello!
Thank you for your help! and sure thing.
My steps for creating a custom connector in the Power Platform.
I used the Power Automate, Custom Connections route. I imported the apiDefinitions.json file using the "Import an OpenAPI file" option. Added the authentication, and made sure the yaml didn't return any errors.
The custom connector works great, but in my ASP.NET web api, I have code that throws specific errors based on validations so that it gives the end-user an idea of what they need to correct on their end.
This way, the power app developer can then throw a Notify to inform the user to make any corrections. Or, if there is a genuine issue with the internal coding, I have some information from the developer to review and inform me about potential issues.
The yaml for the specific record I'm using as I troubleshoot -
/api/sales-record:
post:
tags:
- Sales Order
summary: Create a new sales order
description: Create a new sales order for client
operationId: CreateSalesOrder
consumes:
- application/json
produces:
- application/json
- application/problem+json
parameters:
- in: body
name: body
schema:
$ref: '#/definitions/PostSalesOrderDto'
responses:
'201':
description: Created
schema:
$ref: '#/definitions/GetSalesOrderDto'
'400':
description: Bad Request
schema:
$ref: '#/definitions/ProblemDetails'
'500':
description: Internal Server Error
The yaml for the Problem Details definition -
ProblemDetails:
type: object
properties:
type:
type: string
title:
type: string
status:
format: int32
type: integer
detail:
type: string
instance:
type: string
additionalProperties: false
An example of the response:
{
"type": "Bad Request",
"title": "EXISTING SALES ORDER",
"status": 400,
"detail": "The Sales Order is not unique. Sales Order with id S-525 exist.",
"instance": "POST /api/sales-order"
}
I am not using the Code section of the custom connector options. Code Details is off.
I made changes to the connector a few days ago. I have tested the connector using a new Power Automate flow and a new Power Apps canvas app each time I have done updates. The changes are present and working when I perform this action.
The only thing that is not functional is the return errors. Initially, I tested only with Automate and was able to view the error details. It wasn't until the Power Apps developer reached out to me, stating they couldn't see the error codes in their canvas app, that I began investigating why the error codes were not appearing using the IfError Power fx function.
Using the Live Montitor, it shows the custom connection action as
Category: Network
Result: Error
Result Info: Bad Request
Status: 400
But the body is blank.
Here is the response body from the Live Monitor, I changed the guids to generic guids for purpose of pasting here:
{
"duration": 2813.5,
"size": 191,
"status": 400,
"headers": {
"Cache-Control": "no-cache,no-store,no-cache,no-store",
"Content-Type": "application/problem+json",
"Date": "Fri, 04 Apr 2025 18:22:09 GMT",
"expires": "Thu, 01 Jan 1970 00:00:00 GMT",
"pragma": "no-cache,no-cache",
"ratelimit-limit": "HttpRequestRatePerPort:1500/m,ClientConnectionsPerPort",
"ratelimit-remaining": "HttpRequestRatePerPort:1499",
"ratelimit-reset": "HttpRequestRatePerPort:60s",
"referrer-policy": "same-origin",
"strict-transport-security": "max-age=31536000; includeSubDomains",
"vssaas-request-id": "00000000-0000-4000-8000-000000000001",
"x-content-type-options": "nosniff",
"x-ms-apihub-cached-response": false,
"x-ms-apihub-obo": false,
"x-ms-dlp-gu": "-|-",
"x-ms-dlp-re": "-|-",
"x-ms-environment-id": "11111111-2222-4333-8444-555555555555",
"x-ms-ratelimit-limit": 1500,
"x-ms-ratelimit-remaining": 1496,
"x-ms-ratelimit-reset": 0,
"x-ms-ratelimit-used": 4,
"x-ms-tenant-id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"x-report-abuse": "https://msrc.microsoft.com/report/abuse",
"x-robots-tag": "noindex,nofollow",
"x-served-by": "tunnels-prod-rel-usw3-v3-cluster",
"x-ms-client-request-id": "99999999-8888-7777-6666-555555555555"
},
"body": "",
"responseType": "text"
}