@v-xida-msft Nice non-answer to the question! You've simply not understood what is being asked, and if your solution were useful, @Ancy's question wouldn't even need to be asked in the first place.
I have the same problem. I have a custom connector that works within itself using the "Test Operation" button, but when I call it from a Power App, the request body is null. Technically the API call should work fine if the body is passed in as "body": {} but Power Apps Monitor shows that it's sending "body": "". To clarify, within the custom connector, if we run the Test with no input to the body, the request body gets passed in as {} and the response is successful. However if we call up this connector from within a Power App, the body is passed in as "" and the response looks like this:
{
"duration": 450.39,
"size": 137,
"status": 400,
"headers": {
"Content-Length": 137,
"Content-Type": "application/json; charset=utf-8",
"Date": "Wed, 22 Sep 2021 15:48:09 GMT",
"x-correlation-id": "...",
"x-ms-apihub-cached-response": false,
"x-powered-by": "ARR/3.0,ASP.NET",
"x-ms-client-request-id": "..."
},
"body": [
{
"success": false,
"data": null,
"statusSet": [
{
"code": 6,
"descriptor": "UnableToParse",
"message": "The input field is required.",
"field": ""
}
]
}
]
}
Based on testing this API in Postman with an empty body, that response means that my request has failed because there has to be a body, even if the body is literally just an empty pair of curly brackets: {}.
Whereas I can get the Power App to suggest the header arguments (assuming I set their visibility to "important" rather than "none") and I am able to pass in the headers just fine, but I am unable to get the body parameters to populate the formula suggestions. I have tried this by using {} for the body field in "Import from Sample" in the custom connector definition, and I have obviously also tried this using an actual sample of the body. Either way, neither the body nor its parameters are suggested as arguments in the Power App function editor.
To simplify the troubleshooting process, I have hard-coded the headers into the custom connector for now and made their visibility "none". This way I should be able to call up the custom connector with no input arguments. This works when I click "Test Operation" within the custom connector. And in fact, since we are getting an API response totally unrelated to a failed authorization, I can tell that my hard-coded headers are working fine when calling the custom connector from Power Apps. The error is 100% related to the missing body. I should be able to pass in the raw body as an argument within Power Apps, or I would think so anyway, but I can't figure out how. Or I should be able to set visibility on body parameters to "Important" and then they should show up as suggested arguments in the function editor. But I am not able to make this work.
It's unclear to me what syntax would be necessary here, or how to get those body parameters to fully populate as suggested arguments in the Power Apps function editor.
Would greatly appreciate if any API wizards have some insight!
Thanks