Forum Discussion

chikki1982's avatar
chikki1982
New Contributor
7 years ago

Swagger : Providing Payload to POST Request at runtime

Hi Team,

 

I have a swagger as defined in the attached Sample.yaml

As you can see the POST method takes a definition as the body and when I see this in the swagger editor (https://editor.swagger.io/), (attached  isthe screen shot SwaggerUI.png), at runtime I need to provide the contents of the definition as the body when the content-type is applicaiton/json. I want to understand what is the correct way of providing the body for this post operation

 

Option 1 :

{

       "id":"123",

       "name":"swagger",

       "address":"NY"

}

 

Option 2 : 

 

{

     "input" : {

                         "id" : "123",

                         "name" : "Swagger".

                         "address" : "NY"

                 }

}

 

Or as providers we can support both the options? Any answer in this regard would be much appreciated.

Let me know if you would need any more information.

 

Thanks,

Sree