file’s name indicates the content type to the operating system and any other software trying to use it; so in the following case, the extension added to the resource’s URL (unique identifier) indicates to the server the type of representation wanted.
GET /api/v1/books.json
GET /api/v1/books.xml
Both identifiers reference the same resource—the list of books, but they request a different representation of it.
Note
This approach might seem easier to implement, and even understand, by humans, but it lacks the flexibility added by content negotiation and should only be used if there is no real need