Ratings with REST API
This section explains the REST operations for working the ratings of resources that have been secured with Basic Auth.
Query parameters
The following terms explain the meaning of the query parameters passed with the following REST URIs:
Parameter | Explanation |
---|---|
path | Path of the resource |
value | User's rating of the given resource. It varies in range from 1-5. |
For details on security (the authorization header) and the URI syntax (port, context, etc.), see Registry REST API.
Get the rating of a resource
Attributes | Values |
---|---|
HTTP Method                | GET |
Request URI | /rating?path={ resource path } |
HTTP Request Header | Authorization: Basic { base64encoded(username:password) } |
Description | It retrieves the current overall rating and the user's rating of the requested resource. |
Response | HTTP 200 OK |
Response Type | JSON |
Sample request
curl -X GET -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Cache-Control: no-cache" "https://localhost:9443/resource/1.0.0/rating?path=/_system/governance/trunk/soapservices/com/amazon/soap/1.0.0/AmazonSearchService" -i -k
Add a rating to a resource
Attributes | Values |
---|---|
HTTP Method                | POST |
Request URI | /rate?path={ resource path }&value={ your rating } |
HTTP Request Header | Authorization: Basic { base64encoded(username:password) } |
Description | It adds the user's rating for the resource. The rating can vary between 0 and 5. |
Response | HTTP 204 No Content |
Response Type | JSON |
Sample request
curl -X POST -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" -H "Cache-Control: no-cache" "https://localhost:9443/resource/1.0.0/rate?path=/_system/governance/trunk/soapservices/com/amazon/soap/1.0.0/AmazonSearchService&value=4" -i -k
Delete the user's rating of a resource
Attributes | Values |
---|---|
HTTP Method                | DELETE |
Request URI | /rate?path={ resource path } |
HTTP Request Header | Authorization: Basic { base64encoded(username:password) } |
Description | It deletes the user's rating for the specified resource. |
Response | HTTP 204 No Content |
Response Type | JSON |
Sample request
curl -X DELETE -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" -H "Cache-Control: no-cache" "https://localhost:9443/resource/1.0.0/rating?path=/_system/governance/trunk/soapservices/com/amazon/soap/1.0.0/AmazonSearchService" -i -k
Â