This web service makes it possible to rate an unstructured document.
- 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/documents/{docId}/rating |
Path parameter | Type | Description |
---|---|---|
{docId} |
String | Expects the id associated with the document. Can be obtained by listing documents. |
Request example
The following lines show an example of a JSON request body:
{
"type": "STARS",
"value": 1
}
Field | Type | Required? | Description |
---|---|---|---|
type |
String | Yes | The types of ratings an administrator has enabled for this document. 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 document exists with this identifier. |
For a comprehensive list of all possible return codes, see Return codes.