Creates a new rating for a specified element (gym or training service).
Permission | Description |
---|---|
view (ratable) | Must have view permission on the ratable |
ratings.create | Rate an element |
Name | Type | Required | Description | Example |
---|---|---|---|---|
ratable_type | string | Yes | Type of the element (gym or training_service ) | "gym" |
ratable_id | int | Yes | ID of the element to rate | 10 |
score | int | Yes | Score between 1 and 5 | 5 |
{
"ratable_type": "gym",
"ratable_id": 10,
"score": 5
}
Returns the created rating resource.
{
"rating": {
"id": 123,
"user_id": 42,
"ratable_type": "App\\Models\\Gym",
"ratable_id": 10,
"score": 5
}
}
For a full schema, see Rating Resource.
Status | Description | Reference |
---|---|---|
422 | Validation error | Validation error |
401 | Unauthorized | Authentication error |
403 | Forbidden (no permission) | Permission error |