Share via

APIM Developer Portal "Try It" console shows empty request body intermittently

Andrés Camilo Chávez 0 Reputation points
2026-03-10T17:00:05.5566667+00:00

We are experiencing an intermittent issue with the Azure API Management managed developer portal where the "Try It" console sometimes fails to preload the request body with example data. The body appears completely empty on some page loads, while on others it renders correctly.

Setup:

  • Portal type: Managed
  • OpenAPI version: 3.0.1
  • POST operation with requestBody using $ref to a schema in components/schemas
  • Example data defined at media type level (content > application/json > example)

Minimal reproducible definition:

yaml

openapi: 3.0.1
info:
  title: GateControl API
  version: '1.0'
paths:
  /ControlGate:
    post:
      operationId: controlGate
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GateCommand'
            example:
              action: Open
              facilityId: facility-001
              laneId: lane-01
              licensePlate: ABC123
      responses:
        '200':
          description: Success
components:
  schemas:
    GateCommand:
      required:
        - action
        - facilityId
        - laneId
      type: object
      properties:
        action:
          enum: [Open, Close, Retry]
          type: string
        facilityId:
          type: string
        laneId:
          type: string
        licensePlate:
          type: string
          nullable: 

Steps to reproduce:

  1. Import the OpenAPI 3.0.1 YAML into APIM
  2. Publish the developer portal
  3. Navigate to the POST operation and click "Try It"
  4. The request body is sometimes completely empty — no error, just blank
  5. Refresh the page — body may or may not populate
  6. Repeat to confirm intermittent behavior

What I've tried (none resolved):

  1. Removed a duplicate example block that existed at the schema level
  2. Republished both the API definition and the developer portal
  3. Cleared browser cache and tested in incognito mode
  4. Switched from singular example to plural examples with named entries
  5. Added example values at each individual property level in the schema
  6. Created a simplified API with a minimal schema and the same behavior occurs — confirming the issue is not specific to schema complexityWe are experiencing an intermittent issue with the Azure API Management managed developer portal where the "Try It" console sometimes fails to preload the request body with example data. The body appears completely empty on some page loads, while on others it renders correctly.

Has anyone found a reliable workaround for this?

Azure API Management
Azure API Management

An Azure service that provides a hybrid, multi-cloud management platform for APIs.


1 answer

Sort by: Most helpful
  1. Q&A Assist
    2026-03-10T17:00:21.2966667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    APIM’s interactive “Try it” console in the developer portal sends requests to your APIs the same way as any other client. Intermittent empty request bodies are typically caused by how the backend framework detects whether a body is present, combined with how the request is formed.

    In ASP.NET Core 7 and later, MVC’s model binding now uses IHttpRequestBodyDetectionFeature.CanHaveBody to decide whether a request can have a body. A body is only considered present if the HTTP request has the correct headers/flags, for example:

    • For HTTP/1.x: a non‑zero Content-Length header or Transfer-Encoding: chunked.
    • For HTTP/2: the initial headers frame must not set the END_STREAM flag.

    If these conditions are not met, the framework treats the request as having an empty body and does not attempt deserialization. This can surface as intermittent “empty body” behavior if some requests from the Try It console are missing or mis‑setting these headers.

    Recommended checks and actions:

    1. Inspect the actual HTTP requests sent from the Try It console (via browser dev tools or APIM inspector trace) and verify that:
      • Content-Length is present and non‑zero for requests with JSON or other payloads, or
      • Transfer-Encoding: chunked is set when appropriate.
    2. Ensure the backend API (for example, ASP.NET Core 7+ controllers) is receiving requests with the correct headers so CanHaveBody evaluates to true when a body is expected.
    3. If using ASP.NET Core 7+, no code change is required in MVC itself; instead, ensure clients (including the Try It console) send the appropriate HTTP headers for requests with bodies.

    If the Try It console is correctly sending bodies and headers, but the backend still sees empty bodies intermittently, use APIM inspector traces to confirm that APIM is forwarding the body unchanged and that no policies or intermediaries are stripping or altering Content-Length/Transfer-Encoding.


    References:

    0 comments No comments

Your answer

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