What do you mean with” It shows other data in the list from the database”
If you set the datasource of a listview to Database, without any other constraint, it will retrieve and show all records from the database. Thus If you call a Rest API which stores data before opening the page, the page will still display ALL the record. including those who weren’t retrieved in previous Rest call.
I think you need to place the list view inside a data view and set the data source of the list view to association. In that case it will only list the items associated with the selected item in your data view.
I hope this helps.