Issue with Mandatory Query Parameters Being Added to Template Parameters in Azure API Management (APIM) When Importing OpenAPI Specification

Nilabh Prashar 0 Reputation points
2024-09-18T06:14:34.99+00:00

Hi everyone,

I’m facing an issue while adding an API to Azure API Management (APIM) using an OpenAPI specification. Specifically, all mandatory query parameters are being automatically added to the template parameters in the operation URL, which is causing 404 errors.

We have already implemented custom error handling for these query parameters in a different way with proper messages, so having them in the URL template isn't necessary or desired.

Here’s what I’ve tried so far:

  • I’ve unchecked the setting for "Include required query parameters in operation templates" while importing the API, but the problem persists—query parameters still end up in the template path.

Has anyone else encountered this issue? Any advice or solutions would be greatly appreciated!

Thanks!


This revision pr

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,304 questions
Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
1,935 questions
{count} votes

1 answer

Sort by: Most helpful
  1. JananiRamesh-MSFT 29,221 Reputation points
    2024-10-15T03:59:22.68+00:00

    @Nilabh Prashar Thanks for reaching out. This is by design. All query parameters marked as "required" are converted to template parameters during import. Template parameters are also query parameters, since they're passed in the Url. Since they are marked as required, we convert them as template parameters so that API calls that do not include these parameters will fail with a 404.

    there is an option of manually changing this via form-based editor if you prefer a different behavior,

    User's image

    or you can simply remove the "required" attribute from the open API definition in which case APIM will not convert them to template parameters. 

    do let me know incase of further queries, I would be happy to assist you.


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.