REST API Questions
I'm creating a service with RESTful APIs which will be responsible for serving Oracle transaction logs. The service will provide GET and DELETE APIs to fetch/delete transaction logs in a given time range.
For creating APIs, I have 2 options:
similar for delete use case.
Which one of these would you pick and why?
Correct REST design principles make me tired. There are a lot of very emotional arguments about these. So I don't know what is correct in terms of REST based design, but I do know what I would choose:
I would go with
/logs/table/...if you have another log-related resource other than tables. If not, I would go with
By the way, why
log? The resource is a transaction log, isn't it?
To be fair, REST is fairly open to interpretation as far as what is "correct" but I would probably go with the first option. I think that the URL should be designed in a somewhat logical order. First, you are looking at a table, then looking at a specific table, then looking at that table's logs. This makes more logical sense. Secondly, when you do the query at the end of the URL, the query is really on the logs so having the query as close to the word logs as possible makes the most logical sense.
REST does not say anything about the correct structure of your urls. In fact, it suggests that urls should be discovered and irrelevant to clients. It's considered a best practice to create a logical URL structure, but this is only intended useful for humans and not for REST clients.
Which is better is completely subjective but either is correct in terms of REST based design.