Azure APIM request&response body description

Han Shih 施學翰 146 Reputation points
2021-11-29T06:56:23.95+00:00

Is it possible to import request\response body description from swagger file?

like this
https://swagger.io/docs/specification/2-0/describing-request-body/#:~:text=The%20POST%2C%20PUT%20and%20PATCH%20requests%20can%20have,operation%20may%20have%20other%20parameters%20%28path%2C%20query%2C%20header%29.

and this
https://swagger.io/docs/specification/describing-responses/

It would be nice to show

  • the format of request body
  • the meaning of each field in request body"
  • the format of response body
  • the meaning of each field in response body"

If API consumers can understand

  • the meaning of each field (not just the type)
  • if the field is optional

It can make development more efficient.

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

3 answers

Sort by: Most helpful
  1. MughundhanRaveendran-MSFT 11,616 Reputation points Microsoft Employee
    2021-12-06T08:38:51.12+00:00

    @Han Shih 施學翰 ,

    Thanks for reaching out to Q&A.

    Formatting/describing the request and response body can be done from Swagger. Please refer the below articles

    https://swagger.io/resources/articles/documenting-apis-with-swagger/

    https://swagger.io/docs/specification/2-0/describing-request-body/

    Swagger API can be imported to APIM via Open API specification

    I hope this helps! Feel free to reach out to me if you have any queries or concerns.

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.

    No comments

  2. Han Shih 施學翰 146 Reputation points
    2021-12-07T03:55:13.313+00:00

    @MughundhanRaveendran-MSFT

    Thanks for your reply. Let me make myself clear.

    First, I export the sample yaml file from SwaggerEditor:
    155459-image.png

    Second, I import that file into Azure APIM

    Here are my questions:

    • For POST request
      155460-image.png

    If I want more detail about "how to write my POST request body", the only way is using "definitions", right?
    155503-image.png

    • For GET request
      The same situation
      155428-image.png
      155487-image.png

    To sum up, the detail information about any "structure object" should always be placed in "Definitions".
    Am I right?

    No comments

  3. Han Shih 施學翰 146 Reputation points
    2021-12-07T05:43:02.94+00:00

    In addition, I want to know if "policies" in APIM (by API, operation, product) support import&export feature

    Thanks!

    No comments