This web service provides information about the rating given to an unstructured document.
This web service is available to both authenticated and unauthenticated users with the RATING_USER
role.
Method | Endpoint |
---|---|
GET |
/api/khub/documents/{docId}/rating |
Path parameter | Type | Description |
---|---|---|
{docId} |
String | Expects the id associated with the map. Can be obtained by listing unstructured documents. |
Response body
The following lines show an example of a JSON response body:
{
"publication": {
"type": "STARS",
"rating": {
"date": "2022-10-27T07:32:11.765Z",
"type": "STARS",
"value": 4
}
}
}
Field | Type | Description |
---|---|---|
publication |
Object | Information about the document's rating. |
type |
String | The types of ratings an administrator has enabled for this document. Accepted values are STARS , LIKE , DICHOTOMOUS , and NO_RATING . |
rating |
Object | If the user rated the document, their most recent rating is returned. |
date |
String | The date when the user last rated the document. |
type |
String | The rating's type. May differ from the current rating type if the portal configuration changed since the last rating. Accepted values are STARS , LIKE , and DICHOTOMOUS . |
value |
Number | 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 |
---|---|
200 OK |
The request is valid and data is returned. |
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 document exists with this identifier. |
For a comprehensive list of all possible return codes, see Return codes.