user610217
user610217

Reputation:

How to tell web api ApiExplorer that the endpoint will return binary data (like a zip file)?

For endpoints returning models, we can use the ResponseTypeAttribute to tell the help page documentation what the return data will look like:

/// <summary>
/// returns the specified Foo.
/// </summary>
[ResponseType(typeof(FooModel))]
[HttpGet]
[Route("~/api/foos/{fooId}")]
public async Task<IHttpActionResult> GetFoo(int fooId)
{
    ...
}

This will make a nice entry on the Api Help page, describing how this endpoint will behave.

I want to document that a certain endpoint will return an application/zip binary stream. How can I do that?

Upvotes: 0

Views: 174

Answers (1)

Rahul
Rahul

Reputation: 77896

Well if you already know that your api endpoint going to return zip file then you can set it hard-coded to application/octet-stream.

content-type = "application/octet-stream"

Upvotes: 1

Related Questions