0

When setting up the all the possible response codes and their descriptions for an endpoint in API Management Service, I can only choose an existing status code from a dropdown list, but it doesn't allow me to add a custom status code, such as 499. I use the 499 status code in my API for a specific type of error relevant to my applicatoin. Is there any way to add this to the list of responses?

enter image description here

0

2 Answers 2

1

You could dynamic mocking using APIM with an APIM policy called return-response.

<return-response>
    <set-status code="200" reason="OK" />
    <set-header name="content-type" exists-action="override">
        <value>"application/json"</value>
    </set-header>
    <set-body>{
        "id": "cat12345",
        "name": "Garfield",
        "tag": "Sleepy Cat"
    }</set-body>
</return-response>

For more details, you could refer to this tutorial.

Sign up to request clarification or add additional context in comments.

1 Comment

I don't want to mock it though, because I already have a fully functional API. I need to have it listed there so that it can appear in the API documentation portal.
0

Not with forms UI. But if you select an API, there'll be a pencil in Frontend block on Design tab. It allows you to edit your API specification in OpenAPI 2/3 spec. Using that it should be possible to add a custom response statuses code.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.