PUT /api/{service}/versions/{ID}/ratings/{UserID}

Adds or updates a specific user's rating for a resource. If the rating doesn't exist, this operation adds it; if it already exists, the operation updates it.

This operation is used by the following services:

  • APIs service
  • Apps service
  • Groups service
  • Users service

Authorization Roles/Permissions: Must be logged in.

This topic includes the following sections:

HTTP Method

PUT

URL

https://{hostname}/api/{service}/versions/{ID}/ratings/{UserID}

Sample Request

This section includes sample requests for different services that use this operation:

Sample request: APIs service

The example below shows a specific user changing their rating of the specified API version to 5.

Sample Request URL

https://{hostname}/api/apis/versions/apiversion10024.acmepaymentscorp/ratings/522320b9-cb6b-495d-ae07-e4b3bfdb3f6a.acmepaymentscorp

Sample request headers

PUT /api/apis/versions/apiversion10024.acmepaymentscorp/ratings/522320b9-cb6b-495d-ae07-e4b3bfdb3f6a.acmepaymentscorp HTTP/1.1
Host: {hostname}
Accept: application/json
Content-Type: application/json; charset=UTF-8
X-Csrf-Token_acmepaymentscorp: TokenID%3D8ed70a13-8469-11e8-b37a-b155e4eabeb8%2CexpirationTime%3D153...

Sample request body

{
"Rating":5
}

Sample request: Apps service

The example below shows a specific user changing their rating for an app version to 4.

Sample request URL

https://{hostname}/api/apps/versions/90VsIX3WmpP32sqoYQk8jj4J.acmepaymentscorp/ratings/957482b9-ck7f-0gk5-ae07-9flgok5djtus.acmepaymentscorp

Sample request headers

PUT /api/apps/versions/90VsIX3WmpP32sqoYQk8jj4J.acmepaymentscorp/ratings/957482b9-ck7f-0gk5-ae07-9flgok5djtus.acmepaymentscorp HTTP/1.1
Host: {hostname}
Accept: application/json, text/javascript, */*; q=0.01
Content-Type: application/json; charset=UTF-8
X-Csrf-Token_acmepaymentscorp: TokenID%3D8ed70a13-8469-11e8-b37a-b155e4eabeb8%2CexpirationTime%3D153...

Sample request body

{
  "ID":"90VsIX3WmpP32sqoYQk8jj4J.acmepaymentscorp",
  "UserID":"957482b9-ck7f-0gk5-ae07-9flgok5djtus.acmepaymentscorp",
  "Rating":4
}

Sample request: Groups service

The example below shows a specific user changing their rating for a group to 5.

Sample request URL

https://{hostname}/api/groups/group23509.acmepaymentscorp/ratings/user23509.acmepaymentscorp

Sample request headers

PUT /api/groups/group24386.acmepaymentscorp/ratings/user23509.acmepaymentscorp HTTP/1.1
Host: {hostname}
Accept: application/json, text/javascript, */*; q=0.01
Content-Type: application/json; charset=UTF-8
X-Csrf-Token_acmepaymentscorp: TokenID%3D8ed70a13-8469-11e8-b37a-b155e4eabeb8%2CexpirationTime%3D153...

Sample request body

{
  "Rating":5
}

Sample request: Users service

The example below shows a specific user changing their rating for an app version to 1.

Sample request URL

https://{hostname}/api/apps/versions/AMyrWWlF0Qj2ZPGqF8dPsa7O.acmepaymentscorp/ratings/522320b9-cb6b-495d-ae07-e4b3bfdb3f6a.acmepaymentscorp

Sample request headers

PUT /api/apps/versions/AMyrWWlF0Qj2ZPGqF8dPsa7O.acmepaymentscorp/ratings/522320b9-cb6b-495d-ae07-e4b3bfdb3f6a.acmepaymentscorp HTTP/1.1
Host: {hostname}
Accept: application/json, text/javascript, */*; q=0.01
X-Csrf-Token_acmepaymentscorp: TokenID%3D8ed70a13-8469-11e8-b37a-b155e4eabeb8%2CexpirationTime%3D153...

Sample request body

{
  "ID":"AMyrWWlF0Qj2ZPGqF8dPsa7O.acmepaymentscorp",
  "UserID":"522320b9-cb6b-495d-ae07-e4b3bfdb3f6a.acmepaymentscorp",
  "Rating":1
}

Request Headers

For general information on request header values, refer to HTTP Request Headers.

Header Description
Accept application/json or application/xml
Content-Type

Any one of the following media types is valid for the request Content-Type:

application/json or application/xml

Cookie AtmoAuthToken_{fedmemberid}={cookie value, which usually starts with TokenID}—The platform cookie. This is the Akana API Platform authorization token, and must be sent with every API request that requires login. For more information and an example, see Session cookies.
X-Csrf-Token_{fedmemberID} The CSRF prevention header; may or may not be required, depending on platform settings. See CSRF Prevention on the Platform. By default, the CSRF header is not required for GET operations and is required for all others, with a few exceptions relating to user login.

Request Parameters

Parameter Parm Type Data Type Required Description
ID Path String Required The unique ID of the app version or API version: AppVersionID or APIVersionID.
UserID Path String Required UserID of the user whose rating is being updated.
Rating Body Rating Required The rating information being updated. Only the rating numeric value (1-5) is required.

Response

If successful, this operation returns HTTP status code 200, with the updated rating information.

Sample Response

This section includes sample responses for different services that use this operation:

Sample response: APIs service

The sample response below shows that the operation completed successfully. The updated Rating object is returned in the response.

Sample response headers

Status Code: 200 OK
Content-Type: application/json
Date: Tue, 12 Feb 2013 20:06:20 GMT

Sample response body: application/json

{
  "ID" : "apiversion10025.acmepaymentscorp",
  "UserID" : "user10002.acmepaymentscorp",
  "Rating" : 5
}

Sample response: Apps service

The sample response below shows that the operation completed successfully. The updated Rating object is returned in the response.

Sample response headers

HTTP/1.1 200 OK
Date: Fri, 14 Dec 2012 20:24:15 GMT
Content-Type: application/json

Sample response body

{
  "ID" : "90VsIX3WmpP32sqoYQk8jj4J.acmepaymentscorp",
  "UserID" : "957482b9-ck7f-0gk5-ae07-9flgok5djtus.acmepaymentscorp",
  "Rating" : 4
}

Sample response: Groups service

The sample response below shows that the operation completed successfully. The updated Rating object is returned in the response.

Sample response headers

HTTP/1.1 200 OK
Content-Type: application/json
Date: Wed, 19 Jun 2013 14:01:28 GMT

Sample response body

{
  "ID" : "group24386.acmepaymentscorp",
  "UserID" : "user23509.acmepaymentscorp",
  "Rating" : 5
}

Sample response: Users service

The sample response below shows that the operation completed successfully. The updated Rating object is returned in the response.

Sample response headers

HTTP/1.1 200 OK
Content-Type: application/json
Date: Thu, 30 May 2013 17:31:58 GMT

Sample response body

{
  "ID" : "AMyrWWlF0Qj2ZPGqF8dPsa7O.acmepaymentscorp",
  "UserID" : "522320b9-cb6b-495d-ae07-e4b3bfdb3f6a.acmepaymentscorp",
  "Rating" : 1
}

Response Headers

For general information on response header values, refer to HTTP Response Headers.

Header Description
Content-Type application/json or application/xml

Response Body

Name Type Description
Rating Rating Includes information about the rating, including the updated information.

Error Codes/Messages

If the call is unsuccessful an error code/message is returned. One or more examples of possible errors for this operation are shown below.

Item Value
400 Returned if the client sends invalid parameters or body content. For example, you might get this response if you send malformed XML in your request.
401 Unauthorized. For example, you would get this response if you didn't include the custom X-Csrf-Token_{fedmemberID} header in the request, when it was required by the platform settings; or if you included an invalid or expired value for this header. You would also get this response for any operation that requires login (almost all) if the login cookie was missing.
405 Method Not Allowed. You might get this if there is an error in the URL, or if you used the wrong HTTP verb.
500 An error occurred processing the call.

More information about Akana API Platform API error messages.