PUT and DELETE methods return 404 in API Management

Marcelo Arnaldi 20 Reputation points
2025-01-22T19:50:02.01+00:00

In all APIs created in API Management (APIM), resources with PUT and DELETE methods return a 404 error, indicating that the resource does not exist. However, the GET and POST methods work perfectly.

When calling the backend directly, which is hosted on AKS, all methods work correctly.

Even TRACE works on GET and POST, but does not work on PUT and DELETE.

Note: To avoid typos, when testing the same resource that works with the POST method, when switching to PUT, it returns 404.

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,287 questions
{count} votes

Accepted answer
  1. RithwikBojja 75 Reputation points Microsoft Vendor
    2025-02-04T04:47:12.8633333+00:00

    Hi @Marcelo Arnaldi,

    Thank you for reaching out to MS Q&A.

    To add inbound policy, follow below steps:

    Firstly, In API section, Clicked on API and then on Design.

    Then Clicked on Add Policy as below:

    enter image description here

    Then Clicked on Other Policies:

    enter image description here

    Then pasted below xml :

    <policies>
    
        <inbound>
    
            <cors allow-credentials="true">
    
                <allowed-origins>
    
                    <origin>https://URL</origin>
    
                </allowed-origins>
    
                <allowed-methods>
    
                    <method>GET</method>
    
                    <method>POST</method>
    
                    <method>OPTIONS</method>
    
                    <method>PUT</method>
    
                </allowed-methods>
    
                <allowed-headers>
    
                    <header>*</header>
    
                </allowed-headers>
    
                <expose-headers>
    
                    <header>*</header>
    
                </expose-headers>
    
            </cors>
    
        </inbound>
    
        <backend>
    
            <base />
    
        </backend>
    
        <outbound>
    
            <base />
    
        </outbound>
    
        <on-error>
    
            <base />
    
        </on-error>
    
    </policies>
    

    and then save it:

    enter image description here

    And also check, while you are sending PUT and DELETE request, make sure to give the correct path that the request has been configured with.

    Check if there is any re-routing done, due to which you may face this issue. Also check the logs, so that you can get to know the what causing the real issue.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.