dambel

دمبل

shevron
ورود | ثبت نام

API Docs / ratings / create



POST /api/v1/ratings

Creates a new rating for a specified element (gym or training service).


Permissions

PermissionDescription
view (ratable)Must have view permission on the ratable
ratings.createRate an element

Request Body Parameters

NameTypeRequiredDescriptionExample
ratable_typestringYesType of the element (gym or training_service)"gym"
ratable_idintYesID of the element to rate10
scoreintYesScore between 1 and 55

Request Example

{
  "ratable_type": "gym",
  "ratable_id": 10,
  "score": 5
}

Response

201 Created

Returns the created rating resource.

Example

{
  "rating": {
    "id": 123,
    "user_id": 42,
    "ratable_type": "App\\Models\\Gym",
    "ratable_id": 10,
    "score": 5
  }
}

For a full schema, see Rating Resource.


Error Responses

StatusDescriptionReference
422Validation errorValidation error
401UnauthorizedAuthentication error
403Forbidden (no permission)Permission error
footer wave
logo

دمبل، دنیای هوشمند ورزش و تغذیه

LinkedinInstagramXYoutube