code for fetching details from ids