andreiclara
3 years agoNew Contributor
Swagger example for multipart/form-data sending file in body
I am trying to add an example in "examples.json" external file a swagger.yaml. Until now for PUT/POST I have:
{
"path": "/api/books/{id}",
"method": "PUT",
"examples": [
{
"name": "Update book with file.",
"url": "/api/book/8b7hhhd9-a21b-3m2l-k384-ck88d8b84h51",
"description": "Updates book with ID 8b7dbbb0-a43f-4c6c-a339-cf11b8b04f72 with provided file.",
"body": "-----12345W\r\nContent-Disposition=form-data; name=\"data\"\r\n\r\nUUHHGT5Y\r\n-----12345\r\n",
"headers": {
"Content-Type": "multipart/form-data; boundary=-----12345"
}
}
]
}
and even if I remove "body" parameter or change it, all I get is this error:
have following errors - parameter 'body': 'multipart: NextPart: EOF'