Skip to content

How should I return multiple images from fast API ? #4261

Discussion options

You must be logged in to vote

Hey @yichong96,

Is this an image search service akin to searching Google Images? Wherein a user searches a keyword in their browser, and the browser then displays search results as images in some kind of grid?

If 'yes', I think the second option is still best with some caveats. You'd probably want an API endpoint to perform the query, the result of which returns a JSON response with an array of image URLs matching the query. You could do something like this:

GET /images?q=some+image+search

HTTP/1.1 200 OK
Content-Type: application/json

{
  "query": "some image search",
  "results": [
      {
          "href": "http://somehost.com/path/to/the/first/result.jpg",
          "other_metadata_…

Replies: 6 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@cvillamizara
Comment options

@simondale00
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@vaventt
Comment options

Answer selected by yichong96
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants