Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
This scenario comes up only when i hit the /Files api only when there are folders at the document library and vice versa. But you are sure that you tried both right? Also i believe there is no /Items api.
Thanks for the comment, but receiving a -1 makes everyone feel that an answer is irrelevant. For new users, try giving the suggestions as comments than demotivating them. (My intention was not to promote the mentioned blog, but to point the right answer)