Skip to main content

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

ParameterTypeDescription
search_textstringSearch ebooks by name
filter[active]booleanFilter by active status
filter[is_purchasable]booleanFilter by purchasable status
filter[trashed]booleanInclude trashed ebooks
sortstringSort by field (prefix with - for descending)
per_pageintegerNumber of items per page. Defaults to 10
listbooleanReturn 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

ParameterTypeDescription
namestringRequired. Ebook name (3-255 characters)
product_descriptionstringRequired. Product description (min: 3 characters)
ebook_descriptionstringRequired. Ebook description (min: 3 characters)
posterfileRequired. Image file (jpeg, png, jpg, max: 1MB)
pdf_filefileRequired. PDF file
pricenumberRequired. Price (greater than 0)
pagesintegerRequired. Number of pages (greater than 0)
durationintegerRequired. Duration in days for subscription (greater than or equal to 0)
activebooleanRequired. Ebook active status
is_purchasablebooleanRequired. Whether ebook can be purchased
can_commentbooleanRequired. Allow comments on ebook
hide_pricebooleanRequired. Hide price display
has_quantitybooleanOptional. Enable quantity tracking
quantitynumberRequired if has_quantity is true. Available quantity
has_summarybooleanRequired. Whether ebook has summary
summaryfileRequired if has_summary is true. Summary file (pdf, doc, xls)
summary_pricenumberOptional. Price for summary (greater than or equal to 0)
can_resubscribebooleanOptional. Allow resubscription
resubscription_discountnumberRequired if can_resubscribe is true. Discount percentage
has_special_idbooleanOptional. Enable special ID
tag_namesarrayOptional. 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

ParameterTypeDescription
namestringOptional. Ebook name (3-255 characters)
product_descriptionstringOptional. Product description (min: 3 characters)
ebook_descriptionstringOptional. Ebook description (min: 3 characters)
posterfileOptional. Image file (jpeg, png, jpg, max: 1MB)
pdf_filefileOptional. PDF file
pricenumberOptional. Price (greater than 0)
pagesintegerOptional. Number of pages (greater than 0)
durationintegerOptional. Duration in days for subscription (greater than or equal to 0)
activebooleanOptional. Ebook active status
is_purchasablebooleanOptional. Whether ebook can be purchased
can_commentbooleanOptional. Allow comments on ebook
hide_pricebooleanOptional. Hide price display
has_quantitybooleanOptional. Enable quantity tracking
quantitynumberRequired if has_quantity is true. Available quantity
has_summarybooleanOptional. Whether ebook has summary
summaryfileRequired if has_summary is true. Summary file (pdf, doc, xls)
summary_pricenumberOptional. Price for summary (greater than or equal to 0)
can_resubscribebooleanOptional. Allow resubscription
resubscription_discountnumberRequired if can_resubscribe is true. Discount percentage
has_special_idbooleanOptional. Enable special ID
tag_namesarrayOptional. 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

ParameterTypeDescription
idsarrayRequired. 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