Reputation: 91
Simply, what's better?
API Methods:
GET videos/getall
GET videos/get?id=1
GET news/getall
GET news/get/?id=1
GET blogs/getall
GET blogs/get?id=1
OR
GET content/getall/?type=videos
GET content/getall/?type=news
GET content/get?id=1&type=blogs
First way isn't look like DRY. But it has some advatanges. So what way is better?
Upvotes: 0
Views: 226
Reputation: 16951
All of these URIs are wrong. They include action information(i.e. getall and get) which turns your URIs into regular RPC calls.
You can choose simpler approach:
GET /videos
GET /videos/1
GET /news
GET /news/1
GET /blogs
GET /blogs/1
HTTP GET already means that you are retrieving data.
Upvotes: 1