This web service makes it possible to rate a topic.
- This web service is available to both authenticated and unauthenticated users with the
RATING_USER
role. - Unauthenticated ratings and ratings using an API key only show in the ratings analytics.
Method | Endpoint |
---|---|
POST |
/api/khub/maps/{mapId}/topics/{tocId}/rating |
Path parameter | Type | Description |
---|---|---|
{mapId} |
String | Expects the id associated with the map. Can be obtained by listing maps. |
{tocId} |
String | Expects the id associated with the topic as retrieved when getting a map's table of contents. |
Request example
The following lines show an example of a JSON request body:
{
"type": "STARS",
"value": 5
}
Field | Type | Required? | Description |
---|---|---|---|
type |
String | Yes | The types of ratings an administrator has enabled for this map. Accepted values are STARS , LIKE , DICHOTOMOUS , and NO_RATING . |
value |
Number | Yes | The rating's value. Rating values depend on rating types (STARS : 1 to 5, LIKE : 0 or 1, DICHOTOMOUS : 0 or 1). |
Return code | Description |
---|---|
201 CREATED |
The rating was taken into account. |
401 UNAUTHORIZED |
The authorization header is absent or invalid and the portal's configuration does not allow unauthenticated users to rate content. |
403 FORBIDDEN |
The user or API key does not have the RATING_USER role. |
404 NOT FOUND |
No topic exists with this identifier. |
For a comprehensive list of all possible return codes, see Return codes.