How to get limited number of items from Firebase

So for example I have 20 items in list and 3 sub item in each
And I want to load only 5 items and their subitem then how to do it
Firebase look

Items
______Item1
___________Sub1-Abc
___________Sub2-efg
___________Sub3-hij
______Item2
___________Sub1-abc
___________Sub2-fjsh
___________Sub3-jfhs

  And So On Like This

Then how to fetch limited items and their data

You can use Firebase Rest API instead to get all data at once and show only the required one.
The API is as follows:-
URL- Add .json at end of your Firebase URL
Request Headers-
Authorization: Your Web API Key

Get all tags and then use for each number loop.

I tried butCANT UNDERSTAND I DON’T KNOW WHY I AM GETTING ERROR THAT I tried to get number 3 of a list of length 2
But I have 3 item in database
And set 2 in app for loop

I can’t understand
Can you explain that header
I don’t know what is it I also seen it in may APIs but can’t use because of it

How can you get 3 item of a list having two items?

No it said that error
I don’t tried it
I tried to get 2 item in list of 3

Thanks Everyone i solved that was problem in loop
i was doing something wrong

Can you share the respective blocks?

When firebase 1 tag list
For each number from 1 to 10 by 1
Add item to list name,item=get item from index list =value
Index-get number