Planning the SomeCo whitepapers and ratings API
Before diving into the examples, let's plan the new API at a high level. The following table outlines the URLs, the HTTP methods, and the response formats for each:
URL |
Method |
Description |
Response formats |
|
GET |
Returns a list of whitepapers |
HTML, JSON |
|
GET |
Gets the average rating for a given whitepaper by passing in the whitepaper's nodeId |
HTML, JSON |
|
POST |
Creates a new rating for the specified whitepaper by passing in a rating value and the user who posted the rating |
HTML, JSON |
|
DELETE |
Deletes all ratings for a specified whitepaper |
HTML |
Tip
The API to create new ratings provides the option of passing the username as argument. From a security point of view, this is not ideal because you could provide any values. The ideal solution would be to retrieve the username from the authentication used...