Thinking about semantics again. In this example:
http://corpus-db.org/api/id/807/fulltext
I think this has some issues. As a user, if I see the endpoint for getting some specific data attached to a resource, I should a) also know how to get the resource metadata and b) see how to get the metadata for all resources of that type.
If the endpoint was something like:
http://corpus-db.org/api/v1/books/id/10?fulltext=true
or
http://corpus-db.org/api/v1/books?fulltext=true&id=101
you could infer that
http://corpus-db.org/api/v1/books
gives you all the metadata for the books resource and
http://corpus-db.org/api/v1/books?id=101
gives you metadata, probably with an excerpt, without the full text. Also, if you wind up adding more resources, you've painted yourself into a corner with the approach that only has the id. Imagine if you want to do this:
http://corpus-db.org/api/v1/author?name="Margaret+Atwood"
http://corpus-db.org/api/v1/author?id=391
that doesn't really jive with the format you've established for books, making books a special case rather than a template that allows you to infer how the rest of the system works. I think consistency here makes the whole API a lot more usable and intuitive.
Thinking about semantics again. In this example:
http://corpus-db.org/api/id/807/fulltext
I think this has some issues. As a user, if I see the endpoint for getting some specific data attached to a resource, I should a) also know how to get the resource metadata and b) see how to get the metadata for all resources of that type.
If the endpoint was something like:
or
you could infer that
gives you all the metadata for the books resource and
gives you metadata, probably with an excerpt, without the full text. Also, if you wind up adding more resources, you've painted yourself into a corner with the approach that only has the id. Imagine if you want to do this:
that doesn't really jive with the format you've established for books, making books a special case rather than a template that allows you to infer how the rest of the system works. I think consistency here makes the whole API a lot more usable and intuitive.