Ebook
This section covers the API endpoints for managing ebooks in the admin panel.
List Ebooks
GET /v1/admin/ebooks
Returns a paginated list of all ebooks.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
search_text | string | Search ebooks by name |
filter[active] | boolean | Filter by active status |
filter[is_purchasable] | boolean | Filter by purchasable status |
filter[trashed] | boolean | Include trashed ebooks |
sort | string | Sort by field (prefix with - for descending) |
per_page | integer | Number of items per page. Defaults to 10 |
list | boolean | Return simplified list format |
Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"current_page": 1,
"first_page_url": "http://192.168.0.139:8080/v1/admin/ebooks?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http://192.168.0.139:8080/v1/admin/ebooks?page=1",
"links": [
{
"url": null,
"label": "« السابق",
"active": false
},
{
"url": "http://192.168.0.139:8080/v1/admin/ebooks?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "التالي »",
"active": false
}
],
"next_page_url": null,
"path": "http://192.168.0.139:8080/v1/admin/ebooks",
"per_page": 10,
"prev_page_url": null,
"to": 1,
"total": 1,
"ebooks": [
{
"id": "50b9f010-43bb-11ed-80f7-c111316257a6",
"poster": "http://192.168.0.139:8080/storage/4705/image-(133).png",
"name": "يبلا",
"price": "23.00",
"pages": 2,
"comments_count": 0,
"views_count": 0,
"rating": 0,
"subscriptions_count": 0,
"is_purchasable": true,
"active": false
}
]
},
"status_code": 200
}
Get Ebook Statistics
GET /v1/admin/ebooks/statistics
Returns statistics about ebooks including total sales, best selling and highest rated ebooks.
Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"total_sales": "0",
"best_selling_ebook": [
{
"id": "50b9f010-43bb-11ed-80f7-c111316257a6",
"name": "يبلا",
"poster": "http://192.168.0.139:8080/storage/4705/image-(133).png",
"ebook_orders_count": 0
}
],
"highest_rated_ebook": [
{
"id": "50b9f010-43bb-11ed-80f7-c111316257a6",
"name": "يبلا",
"poster": "http://192.168.0.139:8080/storage/4705/image-(133).png",
"rating": null
}
],
"total_sales_by_country": []
},
"status_code": 200
}
Create Ebook
POST /v1/admin/ebooks
Create a new ebook.
Request Body
| Parameter | Type | Description |
|---|---|---|
name | string | Required. Ebook name (3-255 characters) |
product_description | string | Required. Product description (min: 3 characters) |
ebook_description | string | Required. Ebook description (min: 3 characters) |
poster | file | Required. Image file (jpeg, png, jpg, max: 1MB) |
pdf_file | file | Required. PDF file |
price | number | Required. Price (greater than 0) |
pages | integer | Required. Number of pages (greater than 0) |
duration | integer | Required. Duration in days for subscription (greater than or equal to 0) |
active | boolean | Required. Ebook active status |
is_purchasable | boolean | Required. Whether ebook can be purchased |
can_comment | boolean | Required. Allow comments on ebook |
hide_price | boolean | Required. Hide price display |
has_quantity | boolean | Optional. Enable quantity tracking |
quantity | number | Required if has_quantity is true. Available quantity |
has_summary | boolean | Required. Whether ebook has summary |
summary | file | Required if has_summary is true. Summary file (pdf, doc, xls) |
summary_price | number | Optional. Price for summary (greater than or equal to 0) |
can_resubscribe | boolean | Optional. Allow resubscription |
resubscription_discount | number | Required if can_resubscribe is true. Discount percentage |
has_special_id | boolean | Optional. Enable special ID |
tag_names | array | Optional. Array of tag names |
Response
{
"success": true,
"message": "تم حفظ البيانات بنجاح.",
"data": {
"id": "8e08a6f0-058b-11f0-a299-55b995bf83dc",
"poster": "/storage/29000/Screenshot-from-2025-02-24-13-39-01.png",
"name": "لماذا تطير الغيوم في السماء",
"summary": "",
"summary_name": "",
"pdf_file": "/storage/29001/Mobile_Service_Regions.pdf",
"pdf_name": "Mobile_Service_Regions",
"duration": "unlimited",
"product_description": "سؤالٌ صعب سؤالٌ صعب",
"ebook_description": "سؤالٌ يراودني",
"price": "250",
"price_after_tax": 287.5,
"summary_price": "2",
"pages": "50",
"quantity": null,
"has_special_id": null,
"has_quantity": null,
"can_comment": true,
"hide_price": true,
"is_purchasable": true,
"comments_count": 0,
"views_count": 0,
"has_summary": false,
"can_resubscribe": null,
"resubscription_discount": null,
"active": true,
"tag_names": [
"الصدمة",
"كلام"
]
},
"status_code": 200
}
Get Ebook
GET /v1/admin/ebooks/{id}
Retrieve details of a specific ebook.
Response
{
"success": true,
"message": "تم حفظ البيانات بنجاح.",
"data": {
"id": "50b9f010-43bb-11ed-80f7-c111316257a6",
"poster": "http://192.168.0.139:8080/storage/4705/image-(133).png",
"name": "يبلا",
"summary": "",
"summary_name": "",
"pdf_file": "http://192.168.0.139:8080/storage/4706/subscription-show-–-1.pdf",
"pdf_name": "subscription show – 1",
"duration": "unlimited",
"product_description": "<p class=\"ql-align-right\">رلبييي</p>",
"ebook_description": "<p class=\"ql-align-right\">بللل</p>",
"price": "23.00",
"price_after_tax": 26.45,
"summary_price": "0.00",
"pages": 2,
"quantity": 0,
"has_special_id": false,
"has_quantity": false,
"can_comment": false,
"hide_price": false,
"is_purchasable": true,
"comments_count": 0,
"views_count": 0,
"has_summary": false,
"can_resubscribe": false,
"resubscription_discount": "0.00",
"active": false,
"tag_names": []
},
"status_code": 200
}
Update Ebook
PATCH /v1/admin/ebooks/{id}
Update an existing ebook.
Request Body
| Parameter | Type | Description |
|---|---|---|
name | string | Optional. Ebook name (3-255 characters) |
product_description | string | Optional. Product description (min: 3 characters) |
ebook_description | string | Optional. Ebook description (min: 3 characters) |
poster | file | Optional. Image file (jpeg, png, jpg, max: 1MB) |
pdf_file | file | Optional. PDF file |
price | number | Optional. Price (greater than 0) |
pages | integer | Optional. Number of pages (greater than 0) |
duration | integer | Optional. Duration in days for subscription (greater than or equal to 0) |
active | boolean | Optional. Ebook active status |
is_purchasable | boolean | Optional. Whether ebook can be purchased |
can_comment | boolean | Optional. Allow comments on ebook |
hide_price | boolean | Optional. Hide price display |
has_quantity | boolean | Optional. Enable quantity tracking |
quantity | number | Required if has_quantity is true. Available quantity |
has_summary | boolean | Optional. Whether ebook has summary |
summary | file | Required if has_summary is true. Summary file (pdf, doc, xls) |
summary_price | number | Optional. Price for summary (greater than or equal to 0) |
can_resubscribe | boolean | Optional. Allow resubscription |
resubscription_discount | number | Required if can_resubscribe is true. Discount percentage |
has_special_id | boolean | Optional. Enable special ID |
tag_names | array | Optional. Array of tag names |
Response
{
"success": true,
"message": "تم تحديث البيانات بنجاح.",
"data": {
"id": "8e08a6f0-058b-11f0-a299-55b995bf83dc",
"poster": "/storage/29000/Screenshot-from-2025-02-24-13-39-01.png",
"name": "لماذا تطير الغيوم في السماء",
"summary": "",
"summary_name": "",
"pdf_file": "/storage/29001/Mobile_Service_Regions.pdf",
"pdf_name": "Mobile_Service_Regions",
"duration": "unlimited",
"product_description": "سؤالٌ صعب سؤالٌ صعب",
"ebook_description": "سؤالٌ يراودني",
"price": "250.00",
"price_after_tax": 287.5,
"summary_price": "2.00",
"pages": 50,
"quantity": 3,
"has_special_id": false,
"has_quantity": false,
"can_comment": true,
"hide_price": true,
"is_purchasable": false,
"comments_count": 0,
"views_count": 0,
"has_summary": false,
"can_resubscribe": false,
"resubscription_discount": "0.00",
"active": true,
"tag_names": [
"الصدمة",
"كلام"
]
},
"status_code": 200
}
Delete Ebooks
DELETE /v1/admin/ebooks
Delete one or more ebooks.
Request Body
| Parameter | Type | Description |
|---|---|---|
ids | array | Required. Array of ebook UUIDs to delete |
Response
{
"success": true,
"message": "تم حذف البيانات بنجاح.",
"data": null,
"status_code": 200
}
Authorization
All ebook endpoints require admin authorization. The user must have the appropriate permissions to perform these operations.
Notes
- Ebooks with existing subscriptions cannot be deleted
- When has_summary is set to false, summary_price will be set to 0 and any existing summary file will be removed
- All file uploads must follow the specified size and format restrictions