Image search abstraction layer - what is offset?

Hello all !

I can’t understand what the offset is.

One user story mentions : I can paginate through the responses by adding a ?offset=2 parameter to the URL

I tried to change that offset parameter in the example API, I don’t understand what changes it makes in the JSON result.

Can anyone please help to clarify ? :slight_smile:

I’m not a native english speaker, but the way I understood it is : “if offset = 2, you display result starting at the 2nd item in the list”.In the example API, try changing offset to 10, then 9, then 8, you will see that new elements appear at the start of the list.

yep, you are right, that’s what offset does.

So, correct me if i’m wrong, the example app fetches some images from some search engine (bing or google IDK), then the app will show the results of that search, offset by the number you specify in the offset attribute.

What’s the point ? The search engine will often show different results. The results of the search are not a static list of the same images. And the images are unrelated.

For this specific app, I don’t understand the objective of the offset feature.

I think this specific app assumes that the list is static(whether it’s true or not depends on the api you’re using, but if you ask for the 100 most popular movies on IMDB, I bet the list is gonna be quite static throughout the day) and I think the objective is to be able to navigate through the results, otherwise you would have to display hundreds/thousands of results.

If you made an app that displayed the 1000 most popular movies of all time, and you decided to display 10 results per page, you’d have to use some kind of offset feature for the user to display the next pages of results.

1 Like

When you are doing google search you aren’t getting all the results back at once, google loads additional results if you click on ‘next’ or, if it is image search, when you scroll down. And thats where offset comes in play.

Open Network tab in Dev Tools and see for yourself.

And yes, results may change and you may get results from previous page also on the next page, happens all the time.

1 Like

But the applications purpose is to send a JSON response. So i don’t see the point of having a pagination option. However, I can see the value of having a result size parameter. Can someone whose finished this project shine some light on this. Perhaps I’m mistaken?