Amit
Amit

Reputation: 712

swagger POST with form-post body and json

How can I document following curl request on Swagger?

Also, I want to document the JSON structure in POST fields (payload in following example), is it possible with Swagger?

curl \
-d "type: type1" \
-d "token: 54596977" \
-d "payload: {\"summary\":\"quick summary\",\"color\":\"#e76ce6\",\"role\":\"owner\"}" \
http://localhost/foo/bar

Upvotes: 0

Views: 653

Answers (1)

fehguy
fehguy

Reputation: 6824

That curl doesn't make much sense. If you are passing formData for type and token, then your payload as a JSON body should really not be sent in a http FORM post. Consider either passing type and token as query params and header params respectively, and the payload as a proper JSON body POST. That will make the most sense to the end users.

Upvotes: 1

Related Questions