حَدَّثَنَا يَحْيَى بْنُ حَكِيمٍ، حَدَّثَنَا أَبُو دَاوُدَ، حَدَّثَنَا أَشْعَثُ بْنُ سَعِيدٍ أَبُو الرَّبِيعِ السَّمَّانُ، عَنْ عَاصِمِ بْنِ عُبَيْدِ اللَّهِ، عَنْ عَبْدِ اللَّهِ بْنِ عَامِرِ بْنِ رَبِيعَةَ، عَنْ أَبِيهِ، قَالَ كُنَّا مَعَ رَسُولِ اللَّهِ ـ صلى الله عليه وسلم ـ فِي سَفَرٍ فَتَغَيَّمَتِ السَّمَاءُ وَأَشْكَلَتْ عَلَيْنَا الْقِبْلَةُ فَصَلَّيْنَا وَأَعْلَمْنَا فَلَمَّا طَلَعَتِ الشَّمْسُ إِذَا نَحْنُ قَدْ صَلَّيْنَا لِغَيْرِ الْقِبْلَةِ فَذَكَرْنَا ذَلِكَ لِلنَّبِيِّ ـ صلى الله عليه وسلم ـ فَأَنْزَلَ اللَّهُ ‏ End hadith 7‏ ‏.‏

It wasnarrated from ‘Abdullah bin ‘Amir bin Rabi’ah that his fathersaid: “We were with the Messenger of Allah (PBUH) on a journey, andthesky was overcast so it was difficult for us to determine theQiblah.So we performed prayer, and we marked the location.* Later,when thesun reappeared, we realized that we had prayed facing adirectionother than the Qiblah. We mentioned that to the Prophet(PBUH), thenthe Words were revealed: ‘So wherever you turn there isthe Face ofAllah.’” [2:115] Translation Not Available

Book Ref: Sunan Ibn Majah Book 5 Hadith 1020
Web Ref:  Sunan Ibn Majah Vol 1 Book 5 Hadith 1020