Where to start; Image Search Abstraction Layer


I’ve just finished my link shortener api project, which went fairly well, but now I am presented with the image search abstraction layer project which is perplexing to say the least. I’m not totally sure where to start, so I’m looking for advice. I’m also not totally sure what the project fully does, so a deeper explanation of the project would be very appreciated.

1 Like

Hey Nick,

Yeah, I feel you. I think the title of the project is what can throw the unsuspecting camper off.

More or less, you’re creating an API that when given a query/phrase/expression (eg. “wizards”) will return relevant images from around the web in object form.

Here is mine for an example: https://image-seeker.glitch.me/

For further clarification lets walk through these user stories:

User Story: I can get the image URLs, alt text and page urls for a set of images relating to a given search string.

Images have ALOT of metadata. Your API simply wants you to return a URL to the image (direct link to the image), it’s alt text (or snippet, this describes the image in text) and the page URL (where the image lives).

User Story: I can paginate through the responses by adding a ?offset=2 parameter to the URL.

Think Google Images. They divide every 10 or so search results to a page, pages sequenced by relevancy. It’s the same thing here. No offset, return the N most relevant images. Offset = 1 (IE page 2), return the next set of N most relevant images.

User Story: I can get a list of the most recently submitted search strings.

In other words, every time someone performs a search using your API you’re going to need save the search query and the time it was searched. Your API can bring up a search history, which will pull the N most recent searches from your database They can access this by hitting another endpoint, say /history/

Where you should start

The most simple way to begin is to find an image search API.

It is definitely not part of the scope to develop your own search engine that will trawl and index images relevant to a search query, you can simply forward the request to one that already exists.

There’s plenty to choose from - Google CSE, Bing, Imgur, Flickr to name a few. I used Google CSE just because the API responses match up pretty well to what you need for the first use case.

You need to sign up for API keys, research how to make a request, experiment with requests in your Node app, and then work out how to parse the payload from your external API to prepare your own response.

Best of luck Nick, hope this helped.




Thank you this has been beyond helpful. I fully understand the project now.

1 Like


My last question is how should I go about adding the question mark offset param?

Hey Nick,

I don’t want to give everything away, because the process for searching for and finding out these things are what will solidify them into your brain!

But you will find the answer here: https://expressjs.com/en/api.html

… in particular, in the vicinity of: