close
The Wayback Machine - https://web.archive.org/web/20140813151028/https://developer.beatsmusic.com/docs/read/users/Ratings_Update

Ratings Update

Set a rating on an item for a user.        

The id is the ID of the item being rated. Allowed item types are:

  • albums
  • tracks
  • playlists

 


Endpoint URL

/api/users/:user_id/ratings/:id


HTTP Method

PUT


Authentication

OAuth 2.0: Access token required. See Authentication for examples and details.


Parameters

Name Required Description Example
user_id required Unique ID for User. 1234567890
id required Unique id of the given type tr1234567
rating required Rating value. Pass in 1 to indicate a “like”. Pass in 0 to indicate a “hate”.

Allowed Values: 1, 0
1

Response Elements

ResponseDescription
code

Beats API response code. If successful, code is 'OK'. Otherwise it will be an error code.

type

The entity type of the API object

id

Unique ID of the rating.

rating

Value indicating a user’s rating of an item. Values are either 1, 0. 1 indicates a ‘love’ and 0 indicates a ‘hate’.

updated_at

Epoch timestamp the given object was last updated at.

rated

Object with keys corresponding to rated object types, and values providing the bare information needed for linking to the objects.

ref_type

The API object type of the item being referred to.

id

Unique ID of the referenced item.

display

Text to be displayed when showing a link to the referenced item. Note: this is always going to be blank. The field exists to be consistent with other ‘ref’ objects.


Example Request

curl -X PUT "https://partner.api.beatsmusic.com/v1/api/users/1234567890/ratings/tr99753579" \
    -d "rating=1" \
    -d "access_token=[ACCESS_TOKEN]"

Example Response


{
    "code": "OK",
    "data": {
        "type": "rating",
        "id": "tr99753579",
        "rating": 1,
        "updated_at": 1361468733,
        "rated": {
            "ref_type": "track",
            "id": "tr99753579",
            "display": ""
        }
    }
}
        

Errors

ResourceNotFound [404]

Rating id not found
The item id to be rated could not be found.

Docs Navigation