Rates
This guide explains how to create and retrieve rates and comments for various content types in the Sumaya369 application. The API provides endpoints for managing user ratings, reviews, and comments on different types of content such as courses, bundles, ebooks, and publications.
Get Combined Comments and Rates
Retrieve a paginated list of approved comments and ratings for a specific content item. This endpoint combines both ratings and comments into a single sorted list, making it easy to display user feedback.
Endpoint
- Method: GET
- URL:
/v1/mobile/rateable
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| rateable_id | UUID | Yes | The ID of the content (course, bundle, ebook) |
| rateable_type | string | Yes | Type of content. Must be one of: 'courses', 'bundles', 'ebooks' |
| sort | string | No | Sort direction for results. Default: 'desc' |
| orderBy | string | No | Field to sort by. Default: 'created_at' |
| search_text | string | No | Filter comments/rates by text content |
Success Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"current_page": 1,
"first_page_url": "http://127.0.0.1:8000/v1/mobile/rateable?rateable_type=courses&rateable_id=d0783b40-b67a-11ec-9e13-e789e2016520&page=1",
"from": 1,
"last_page": 23,
"last_page_url": "http://127.0.0.1:8000/v1/mobile/rateable?rateable_type=courses&rateable_id=d0783b40-b67a-11ec-9e13-e789e2016520&page=23",
"links": [
{
"url": null,
"label": "« السابق",
"active": false
},
{
"url": "http://127.0.0.1:8000/v1/mobile/rateable?rateable_type=courses&rateable_id=d0783b40-b67a-11ec-9e13-e789e2016520&page=1",
"label": "1",
"active": true
},
{
"url": "http://127.0.0.1:8000/v1/mobile/rateable?rateable_type=courses&rateable_id=d0783b40-b67a-11ec-9e13-e789e2016520&page=2",
"label": "2",
"active": false
},
],
"next_page_url": "http://127.0.0.1:8000/v1/mobile/rateable?rateable_type=courses&rateable_id=d0783b40-b67a-11ec-9e13-e789e2016520&page=2",
"path": "http://127.0.0.1:8000/v1/mobile/rateable",
"per_page": 10,
"prev_page_url": null,
"to": 10,
"total": 226,
"rates": [
{
"id": "8e6555e0-ffd2-11ef-a8f5-6d2a96fd45f5",
"rate": null,
"email": "developer@sumaya369.net",
"name": "Hamad Alshabanah",
"comment": "can we do it !!",
"source": "comment",
"status": "approved",
"avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"created_at": "2025-03-13",
"reply": null
},
{
"id": "625525d0-b16c-11ef-8fb8-33ccf1b5a8d0",
"rate": "5",
"email": "masaqjaneja@gmail.com",
"name": "مساق جنانة",
"comment": "احبج سمية خليتني اعرف شعور الفرح مرة ثانية",
"source": "rate",
"status": "approved",
"avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"created_at": "2024-12-03",
"reply": null
},
{
"id": "cffa47e0-ae92-11ef-9e39-4bde9771cf5f",
"rate": "5",
"email": "noor.malsh27@hotmail.com",
"name": "نور محمد",
"comment": "دورة ممتازة تفهم من خلالها شعور الحزن بعمق ومع تمارين ممتعة ساعدتني في تخطي الشعور وتغيير نظرتي للحياة ، شكرا دكتورة سمية ❤️",
"source": "rate",
"status": "approved",
"avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"created_at": "2024-11-29",
"reply": null
},
{
"id": "11d5bf60-ab3f-11ef-bd2a-3dbdf78182ef",
"rate": "5",
"email": "313manal@gmail.com",
"name": "منال التركي",
"comment": "مادة تحرك الجمود الداخلي وتعيدك للحياه والاهتمام بنفسك شكرا دكتوره سميه",
"source": "rate",
"status": "approved",
"avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"created_at": "2024-11-25",
"reply": null
},
{
"id": "0968e430-9a9f-11ef-bc0c-bba2be3128c0",
"rate": "5",
"email": "themiracle.79@gmail.com",
"name": "حنان الغافلي",
"comment": "تمارين ممتعة وبسيطة، لكن تحتاج استمرار ومداومة.",
"source": "rate",
"status": "approved",
"avatar": "http://127.0.0.1:8000/storage/9799/IMG_20220623_205528_295.jpg",
"created_at": "2024-11-04",
"reply": null
},
{
"id": "b064d6d0-8b9c-11ef-9da7-075132b40788",
"rate": "5",
"email": "lamaalkafry@gmail.com",
"name": "Lama Alkafry",
"comment": "إكتشفت سبب حزني أنه تم إهمالي من الطفولة و للأسف لما كبرت قمت أنا بإهمال نفسي و عدم وضعها أولاً ، لكن من خلال التطبيق العملي في جلسة الحزن رجعت أحس بأهمية نفسي و أنه من حقي أقوم بعدة اعمال في اليوم تشعرني بقيمتي وإني أستحق الأفضل .",
"source": "rate",
"status": "approved",
"avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"created_at": "2024-10-16",
"reply": null
},
{
"id": "c529a120-898f-11ef-a3f1-cd7b118c9de2",
"rate": "5",
"email": "afraah.bibi@gmail.com",
"name": "Af A",
"comment": "🤍🤍🤍",
"source": "rate",
"status": "approved",
"avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"created_at": "2024-10-13",
"reply": null
},
{
"id": "a440a760-84da-11ef-9667-1fb4dd7a7ff4",
"rate": "5",
"email": "hdream969@gmail.com",
"name": "Nada Hammoodi",
"comment": "تجربة جميلة وفهم عميق لمعنى الحزن",
"source": "rate",
"status": "approved",
"avatar": "http://127.0.0.1:8000/storage/20873/IMG_0427.jpeg",
"created_at": "2024-10-07",
"reply": null
},
{
"id": "ac55f1b0-8274-11ef-acee-57ed50c67e31",
"rate": "5",
"email": "ghadah.yahya@gmail.com",
"name": "ghada Yahya",
"comment": "ممتاز جداً",
"source": "rate",
"status": "approved",
"avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"created_at": "2024-10-04",
"reply": null
},
{
"id": "c8e2d9e0-81c1-11ef-a1be-cfa6ed60f0f4",
"rate": "5",
"email": "kholoudd8995@gmail.com",
"name": "Kholoud Hamdan",
"comment": "شكرا لك ♡ \r\nمحتوى مفيد جدا",
"source": "rate",
"status": "approved",
"avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"created_at": "2024-10-03",
"reply": null
}
]
},
"status_code": 200
}
Store Rate
Create a new rating or review for a specific content item. This endpoint allows authenticated users to submit ratings and optional comments for courses, bundles, ebooks, and publications. All submissions require admin approval before becoming publicly visible.
Endpoint
- Method: POST
- URL:
/v1/mobile/rates
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| rate | number | Yes | Rating value between 0.5 and 5 |
| comment | string | No | Review comment (3-255 characters) |
| rateable_id | UUID | Yes | ID of the content being rated |
| rateable_type | string | Yes | Type of content. Must be one of: 'courses', 'bundles', 'ebooks' |
Success Response
{
"success": true,
"message": "تم حفظ البيانات بنجاح.",
"data": {
"id": "06a150c0-0490-11f0-bd10-6f63ebd63823",
"rate": 3.5,
"email": "aalbaiti360@gmail.com",
"name": "اسم العميل",
"comment": "وفاء التلهوني",
"status": null,
"meta": null,
"verified": null,
"rateable_id": "2b091e90-40c6-11ed-b4bd-8d988b91cc4e",
"rateable_type": "App\\Models\\Bundle",
"writerable_id": "df5323f6-3891-4337-978a-94ef244c82c5",
"writerable_type": "App\\Models\\Customer",
"reply": null,
"created_at": "2025-03-19 10:01:48",
"updated_at": "2025-03-19 10:01:48"
},
"status_code": 200
}
Error Responses
Rating Not Allowed (400)
{
"success": false,
"message": "لا يمكنك التقييم. اما انك غير مشترك او تمت عملية التقييم مسبقا",
"errors": "لا يمكنك التقييم. اما انك غير مشترك او تمت عملية التقييم مسبقا",
"data": null,
"status_code": 400
}
Content Not Found (404)
{
"success": false,
"message": "لم يتم العثور على السجل",
"data": [],
"status_code": 404
}
Example Implementation Flow
-
Retrieving Comments and Rates
- Application sends GET request to
/v1/mobile/rateable - Provide required parameters:
- rateable_id for the content
- rateable_type to specify content type
- Optional parameters:
- sort and orderBy for custom sorting
- search_text to filter by content
- System combines comments and rates into a single list
- Only approved items are included
- Results are paginated (10 items per page)
- Application sends GET request to
-
Creating New Rates
- User must be authenticated
- Application sends POST request to
/v1/mobile/rates - Provide required data:
- rate value (0.5 to 5)
- rateable_id and rateable_type
- Optional: Include comment (3-255 characters)
- System sets initial status as 'pending'
- Admin approval required before rate appears publicly
Key Considerations
- Comments are distinguished by source: 'comment'
- Rates are distinguished by source: 'rate'
- Comments have null rate value
- Replies are only visible when approved
- For ebooks and courses, verify can_rate property