I have a simple external service definition that can return a 202 or a 401.
I cannot figure out how to tell which response code is returned.
The endpoint is an azure HTTP endpoint on microsoft power automate.
It is receiving and consuming the POST properly.
It does not return anything on success so there are no body parameters to evaluate.
I've tried assigning the action output to a text variable and displaying on a screen, and have also tried displaying the output directly on a screen, and they are all empty / null.
I have confirmed via postman that i will receive a 202 when i POST to the endpoint.
Feels like I am missing something fundamental here (likely, in fact...) but not sure where to go now.
The endpoint definition is as follows
{
"swagger": "2.0",
"info": {
"title": "MSFT Endpoint",
"description": "Send id to msft power automate.",
"version": "1.0.0"
},
"paths": {
"/": {
"post": {
"summary": "sends the id.",
"consumes": [
"application/json"
],
"produces":[
"application/json"
],
"parameters": [
{
"in": "body",
"name": "inputparms",
"description": "id and process",
"schema": {
"type": "object",
"properties" : {
"recordId" : {
"type": "string"
},
"processName": {
"type": "string"
}
}
}
}
],
"responses": {
"202": {
"description": "Success!",
"headers": {
"status" : {
"type" : "string"
}
}
},
"401": {
"description": "auth issue",
"schema": {
"$ref": "#/definitions/Error"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
}
}
,
"definitions": {
"Error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
]
}
}
}
Screenshot of the flow and the result below
overview:
final output screen display text:
final output screen result:
EDIT : Adding some more things I have tried, and figured it out.
Tried manually mapping the output variables in the flow action
Tried automatically mapping the success and error action outputs in flow action and testing if they are null in a formula (both evaluated to false)
I ran in debug mode and can actually see the 202 in the output
I added a formula field to evaluate ISBLANK on 202 evaluates to FALSE, but ISBLANK on 401.code and defaultError.code evaluates to TRUE.
So that is the answer. If there is no response body to evaluate, use a formula to evaluate if the response is blank.