This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple response content types in one endpoint? #82
Comments
Documenting this in OpenAPI is something is currently not supported, although you can return anything you want if you use a Starlette response: https://www.starlette.io/responses/ But I'll have it in mind while checking how to document multiple response types.
That's great to hear! Thanks! ...although it is actually the case that it is not documented (yet) 🙈 |
Thanks! |
It is now possible to add a parameter The specific example with a different media type (the example is with an image) is here: https://fastapi.tiangolo.com/tutorial/additional-responses/#additional-media-types-for-the-main-response It is available in version |
@tiangolo link provided in your answer give me an 404 error can you provide the correct link thanks ! |
@tiangolo Maybe the URL should be https://fastapi.tiangolo.com/advanced/additional-responses/ ? |
Yep, thanks for the link @jbkoh . I moved the docs when separating the tutorial in basic and advanced. |
looks good now thanks @tiangolo |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Description
How can I [...]?
I'm trying to figure out how to use one endpoint for multiple response content_types? I want to create an /export API endpoint and be able to dump (from memory) responses such as application/json, application/yaml or application/zip based on the content-type requested.
Everything I've seen so far is just for a single response type - though I've probably missed something because this is one of the best documented projects I've used.
The text was updated successfully, but these errors were encountered: