Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Post method on Swagger

Not applicable

Can anyone tell me how to add json/xml body for POST calls on swagger????

0 1 873
1 REPLY 1

Not applicable

You can reference the schema in the parameters section, then in the definitions section you can specify the JSON object. Example parameter definition:

parameters:
  - name: requestBody
    in: body
    description: 'request body'
    required: true
    schema:
      $ref: '#/definitions/requestBody'