API Management throwing 404 if request is not hard-coded into the Design

EJ Marmonti 146 Reputation points
2022-06-13T16:09:19.043+00:00

I have an Azure API Management resource configured with an app running behind it on app services. The Web service URL is set to the app service, and the API URL suffix is not defined (so the root of the API management will forward those requests through to the app service). I'm running into a strange issue where it's throwing 404's if the api endpoints are not pre-defined under the Design section.

Some background information:

  • We have an endpoint, such as /api/orders/X
  • If I hit /api/orders/X directly on the app service origin, it responds with the information I expect.
  • If I hit /api/orders/X through the API management, I get a 404.
  • If I hard-code the /api/orders/X endpoint as a testing endpoint, in order to do traces, under Design (per https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-api-inspector), it starts responding with the results I expect (against the API Management fqdn).
  • Now if I try /api/orders/Y, I get a 404 again. Once I add /api/orders/Y as a new test under the Design section, this starts responding correctly.

It seems like the API Management wants me to hard-code every possible api request that will be made against this app. Might I have a policy that is controlling this setting that could be misconfigured? If it's helpful, below is a screenshot of the test call to /api/orders/X that was failing until I added the test connection here.

210899-image.png

Additionally, after I added this test (to /api/orders/X), the call would work, however another problem was that if I added it with a query parameters, it basically broke any requests that did not contain query parameters (they responded with a 404).

Why might the API Management be throwing 404's in this manner?

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

1 answer

Sort by: Most helpful
  1. EJ Marmonti 146 Reputation points
    2022-06-16T14:24:18.297+00:00

    Solving my own question here. Per https://learn.microsoft.com/en-us/azure/api-management/add-api-manually:

    By default, when you add an API, even if it's connected to some back-end service, APIM won't expose any operations until you allow them. To allow an operation of your back-end service, create an APIM operation that maps to the back-end operation.

    To in order to not have to define each individual operation, I can just add a "GET /", or "POST /", etc operation. Problem solved.

    0 comments No comments

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.