Azure API Management: Instead 202 Accepted how to return 200 Ok HTTP status for a POST request from azure api management

Vivek Komarla Bhaskar 20 Reputation points
2024-06-19T12:02:51.24+00:00

Hi,

My client wants the response to be 200 Accepted instead of 202 Accepted for a POST API call I have created on Azure API Management calling a logic app. How can I achieve this?

Here are few screenshots of my API on Azure API Management & Logic App -

1

2

3

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
1,930 questions
Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
1,063 questions
{count} votes

Accepted answer
  1. Aki Nishikawa 1,305 Reputation points Microsoft Employee
    2024-06-20T07:47:35.5633333+00:00

    Hello @Vivek Komarla Bhaskar ,I'm not sure why your client does not return 200 with Response action in Logic Apps, but if they need to change HTTP status returned by Logic Apps, they need to use policies to modify HTTP status returned from the backend Logic Apps.

    Here is a sample code. This code changes HTTP status to 200 if response status code is equal to 202.

    <outbound>
        <base />
        <choose>
            <when condition="@(context.Response.StatusCode==202)">
                <set-status code="200" />
            </when>
            <otherwise />
        </choose>
    </outbound>
    

    User's image

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful