Madrasa API API Reference
The Api powering the Madrasa website
API Endpoint
https://api.madrasa.org/
Contact: [email protected]
Request Content-Types: application/json
Response Content-Types: application/json
Schemes: https
Version: 1.0.0
Authentication
jwt_token
Authentication token got during the login. Header syntax: Authorization: Bearer <json_web_token>
Reset Password
GET /check-reset-password-token
Checks if a reset password token is valid
Example /check-reset-password-token?<token>
The token to check the validity
The token is valid. The endpoint also returns the email of the user associated with the reset token.
The token is invalid / expired or unknown
Response Content-Types: application/json
Response Example (200 OK)
{
"status": "valid",
"email": "[email protected]"
}
Response Example (422 Unprocessable Entity)
{
"message": "invalid_token"
}
POST /send-reset-password-email
sends a reset password email
The email to send the reset password
The language of the email which will be sent, 'ar' or 'en', default is arabic ('ar')
Success on sending the reset email
Unknown email, the email provided does not exist in the database.
The user has been registred through a social login and does not have a password to reset.
Response Content-Types: application/json
Response Example (200 OK)
{
"message": "ok"
}
Response Example (404 Not Found)
{
"message": "unkwown_user"
}
Response Example (422 Unprocessable Entity)
{
"message": "use_facebook_auth"
}
POST /reset-password
Login
POST /login
Login with a wordpress account The JSON token you get back can be then used in the HTML headers: Authorization : Bearer <json_web_token>
email of the user
password
JSON access token
unexpected error
Response Content-Types: application/json
Response Example (200 OK)
{
"accessToken": "<json_web_token>"
}
Response Example (500 Internal Server Error)
{
"message": "string"
}
GET /login/facebook
Login redirection to Facebook
Redirects directly the user to the Facebook auth page
It will redirect then back to {website URL}/login/social/callback
with the following in the url parameters:
-
Sent all the time:
type=facebook
(type will be google for the google auth) -
Sent on success only:
accessToken=<JWT TOKEN>
, you will receive the accessToken used for this user. -
Sent on failure only:
error=<error string>
, on error you will receive an error in the query string, this error can either besocial_auth_needs_email
if the user denied access to the email address on the Facebook modal (email is mandatory) or any error string returned by Facebook.
Response Content-Types: application/json
GET /login/google
Login redirection to Google
Redirects directly the user to the Google auth page
It will redirect then back to {website URL}/login/social/callback
with the following in the url parameters:
-
Sent all the time:
type=google
(type will be Facebook for the Facebook auth) -
Sent on success only:
accessToken=<JWT TOKEN>
, you will receive the accessToken used for this user. -
Sent on failure only:
error=<error string>
, on error you will receive an error in the query string, this error can either besocial_auth_needs_email
if the user denied access to the email address on the Google modal (email is mandatory) or any error string returned by Google.
Response Content-Types: application/json
GET /register/facebook/callback
Login throuh Facebook with a Facebook token, it should only be used by mobile apps
Example: /register/facebook/callback?code=<facebook-access-token>&get-token
Facebook auth token returned by the Facebook SDK
Asks the API to return the token directly instead of redirecting (strongly recommended for mobile apps)
App access token to use for any authenticated call
Facebook authentication failed
Response Content-Types: application/json
Response Example (200 OK)
{
"accessToken": "<json_web_token>"
}
Response Example (500 Internal Server Error)
{
"message": "string"
}
GET /register/google/mobile
Login throuh Google with a Google token, it should only be used by mobile apps
Example: /register/google/mobile?code=<google-code>&scope=openid+email+https://www.googleapis.com/auth/plus.me+https://www.googleapis.com/auth/userinfo.email&get-token
Google auth token returned by the Google SDK
Google API data scope
Example: openid+email+https://www.googleapis.com/auth/plus.me+https://www.googleapis.com/auth/userinfo.email
Asks the API to return the token directly instead of redirecting (strongly recommended for mobile apps)
App access token to use for any authenticated call
Google authentication failed
Response Content-Types: application/json
Response Example (200 OK)
{
"accessToken": "<json_web_token>"
}
Response Example (500 Internal Server Error)
{
"message": "string"
}
Profile
GET /profile
returns the user profile
user profile
Response Content-Types: application/json
Response Example (200 OK)
{
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"first_name": "John",
"last_name": "Doe",
"date_of_birth": "1991-07-30",
"gender": "female",
"city": "Nancy",
"type": "student",
"updated_at": "2018-12-03T09:04:42.000Z",
"nationality_": {
"id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942",
"code": "TD",
"name_en": "Chad",
"name_ar": "تشاد"
},
"country_of_residence_": {
"id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942",
"code": "TD",
"name_en": "Chad",
"name_ar": "تشاد"
}
}
Category
GET /category
Get all the categories
Get associated data.
- If you use
/category/with:sections
, you will get an arrary of sections for each category - If you use
/category/with:sub_sections
, you will get sections with sub_sections inside for each category.
Response Content-Types: application/json
Response Example (200 OK)
[
{
"id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942",
"title": "الرياضيات",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "الرياضيات",
"created_at": "2018-12-03T09:04:42.000Z",
"updated_at": "2018-12-03T09:04:42.000Z",
"enabled": true,
"weight": 0,
"tags": [
"toto"
]
}
]
GET /category/{categoryId}
Get a category
Sections associated with a category id
Get associated data.
- If you use
/category/{categoryId}/with:sections
, you will get an array of sections for the category - If you use
/category/{categoryId}/with:sub_sections
, you will get sections with sub_sections inside for the category.
Get the category from its ID
Invalid id provided
Response Content-Types: application/json
Response Example (200 OK)
{
"id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942",
"title": "الرياضيات",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "الرياضيات",
"created_at": "2018-12-03T09:04:42.000Z",
"updated_at": "2018-12-03T09:04:42.000Z",
"enabled": true,
"weight": 0,
"tags": [
"toto"
]
}
Response Example (422 Unprocessable Entity)
GET /category/slug/{categorySlug}
Get a category by slug
The slug of the category
Get associated data.
- If you use
/category/{categoryId}/with:sections
, you will get an array of sections for the category - If you use
/category/{categoryId}/with:sub_sections
, you will get sections with sub_sections inside for the category.
Get a category according from its slug
Invalid id provided
Response Content-Types: application/json
Response Example (200 OK)
{
"id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942",
"title": "الرياضيات",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "الرياضيات",
"created_at": "2018-12-03T09:04:42.000Z",
"updated_at": "2018-12-03T09:04:42.000Z",
"enabled": true,
"weight": 0,
"tags": [
"toto"
]
}
Response Example (422 Unprocessable Entity)
GET /category/{categoryId}/sections
Get sections by category
Sections associated with a category id
Get the sections associated with the category
Invalid id provided
Response Content-Types: application/json
Response Example (200 OK)
[
{
"id": "5cf46551-b699-44ca-94c5-025e86685e32",
"title": "العد",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "العد",
"created_at": "2018-12-03T09:05:50.000Z",
"updated_at": "2018-12-03T09:05:50.000Z",
"enabled": false,
"weight": 0,
"tags": [
"العد"
],
"category_id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942"
}
]
Response Example (422 Unprocessable Entity)
Likes
GET /user/like
Get the whole list of user likes (only likes on lessons are supported for now)
Authentication token got during the login. Header syntax: Authorization: Bearer <json_web_token>
undefined
Response Content-Types: application/json
Response Example (200 OK)
{
"lessons": [
"289f7211-3a94-4cc5-b282-997fb38e8651"
]
}
GET /like/{lessonId}
Like or unlike a lesson
Authentication token got during the login. Header syntax: Authorization: Bearer <json_web_token>
Id of the lesson to like or unlike
undefined
Response Content-Types: application/json
Response Example (200 OK)
{
"message": "ok",
"like": true
}
Competition
GET /winner
Get a list of the last 7 winners of the competition
Authentication token got during the login. Header syntax: Authorization: Bearer <json_web_token>
the list of the last 7 winners ordered by most recent winning date.
Response Content-Types: application/json
Response Example (200 OK)
[
{
"id": "0f6c6cd4-3379-45be-a28a-d05d2ae010ba",
"created_at": "2018-12-03T09:04:42.000Z",
"selection_status": "winner",
"reviewed_date": "2018-12-03T09:04:42.000Z",
"profile": {
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"first_name": "John",
"last_name": "Doe",
"date_of_birth": "1991-07-30",
"gender": "female",
"city": "Nancy",
"type": "student",
"updated_at": "2018-12-03T09:04:42.000Z",
"nationality_": {
"id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942",
"code": "TD",
"name_en": "Chad",
"name_ar": "تشاد"
},
"country_of_residence_": {
"id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942",
"code": "TD",
"name_en": "Chad",
"name_ar": "تشاد"
}
}
}
]
POST /question/answer
answers the current question for the competition, you might get events back with points.
Authentication token got during the login. Header syntax: Authorization: Bearer <json_web_token>
The answer id
example: answerId=d19fbe0a-bd03-4fdc-9adb-2c99f6999215
The current question of the day for the competition, you might get events back with points
Missing argument
Response Content-Types: application/json
Response Example (200 OK)
{
"message": "ok",
"events": {
"points": 5
}
}
Response Example (422 Unprocessable Entity)
{
"message": "missing_argument",
"argument": "answerId"
}
GET /question/current
Gets the current question of the day for the competition
The current question of the day for the competition
Response Content-Types: application/json
Response Example (200 OK)
{
"id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942",
"created_at": "2019-01-22T05:07:01.079Z",
"order": 1,
"status": "current",
"type": "text",
"value": "اشترى سمير تفاحًا وموزًا من البقالّة. إذا علمت أنّ ثمن التفاح 25.85 درهمًا والموز 20.655 درهمًا، وأنّ قيمة الضريبة المضافة عليهما معًا تبلغ 2.3 درهمًا، كم يجب أن يدفع سمير لصاحب البقالة؟",
"begin_at": "2019-01-22T00:00:00.000Z",
"end_at": "2019-01-23T00:00:00.000Z",
"answer_type": "mcq",
"answers": [
{
"id": "d19fbe0a-bd03-4fdc-9adb-2c99f6999215",
"created_at": "2019-01-22T05:07:01.092Z",
"value": "hello"
}
],
"lessson_": {
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"title": "عدّ الأرقام الصغيرة",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "عدّ الأرقام الصغيرة",
"created_at": "2018-12-03T09:05:50.000Z",
"updated_at": "2018-12-03T09:05:50.000Z",
"enabled": false,
"weight": 1,
"tags": [
"عدّ الأرقام الصغيرة"
],
"youtube_video_id": "2345678901",
"description": "عدّ الأرقام الصغيرة",
"sub_section_id": "0f6c6cd4-3379-45be-a28a-d05d2ae010ba"
}
}
Lesson
GET /daily/lesson
returns the daily lesson
The daily lesson
Response Content-Types: application/json
Response Example (200 OK)
{
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"title": "عدّ الأرقام الصغيرة",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "عدّ الأرقام الصغيرة",
"created_at": "2018-12-03T09:05:50.000Z",
"updated_at": "2018-12-03T09:05:50.000Z",
"enabled": false,
"weight": 1,
"tags": [
"عدّ الأرقام الصغيرة"
],
"youtube_video_id": "2345678901",
"description": "عدّ الأرقام الصغيرة",
"sub_section_id": "0f6c6cd4-3379-45be-a28a-d05d2ae010ba"
}
GET /video-activity
returns an array of the last 5 lesson watched. Returns the data from POST /lesson/{lessonId}/record-video-activity (see documentation of this endpoint)
returns an array of the last 5 lesson watched. Returns the data from POST /lesson/{lessonId}/record-video-activity (see documentation of this endpoint)
Response Content-Types: application/json
Response Example (200 OK)
[
{
"id": "5cf46551-b699-44ca-94c5-025e86685e32",
"type": "completed",
"lesson_": {
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"title": "عدّ الأرقام الصغيرة",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "عدّ الأرقام الصغيرة",
"created_at": "2018-12-03T09:05:50.000Z",
"updated_at": "2018-12-03T09:05:50.000Z",
"enabled": false,
"weight": 1,
"tags": [
"عدّ الأرقام الصغيرة"
],
"youtube_video_id": "2345678901",
"description": "عدّ الأرقام الصغيرة",
"sub_section_id": "0f6c6cd4-3379-45be-a28a-d05d2ae010ba"
}
}
]
POST /watchlist/{lessonId}
Add a lesson to the watchlist
Add a lesson successfully
The lesson id does not exist
Response Content-Types: application/json
Response Example (200 OK)
{
"message": "ok"
}
Response Example (422 Unprocessable Entity)
{
"message": "entity_not_found"
}
DELETE /watchlist/{lessonId}
Deletes a lesson from the watchlist
Add a lesson successfully
Response Content-Types: application/json
Response Example (200 OK)
{
"message": "ok"
}
POST /lesson/{lessonId}/record-video-activity
Records the activity of the user when watching a video
Authentication token got during the login. Header syntax: Authorization: Bearer <json_web_token>
The event can only be 'started' or 'completed', the api will refuse anything else.
The event has been recorded, if you send a completed event, you get one point back as an event.
The event is invalid
Response Example (200 OK)
{
"message": "ok",
"events": {
"points": 1
}
}
Response Example (422 Unprocessable Entity)
{
"message": "invalid_event",
"text": "event must be either \"started\" or \"completed\""
}
GET /lesson/{lessonId}
Get lesson by Id
Get a lesson by id
Get a lesson by id
Lesson not found
Invalid id provided
Response Content-Types: application/json
Response Example (200 OK)
{
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"title": "عدّ الأرقام الصغيرة",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "عدّ الأرقام الصغيرة",
"created_at": "2018-12-03T09:05:50.000Z",
"updated_at": "2018-12-03T09:05:50.000Z",
"enabled": false,
"weight": 1,
"tags": [
"عدّ الأرقام الصغيرة"
],
"youtube_video_id": "2345678901",
"description": "عدّ الأرقام الصغيرة",
"sub_section_id": "0f6c6cd4-3379-45be-a28a-d05d2ae010ba"
}
Response Example (404 Not Found)
{
"message": "lesson not found"
}
Response Example (422 Unprocessable Entity)
GET /lesson/slug/{lessonSlug}
Get lesson by Slug
Get a lesson by id
Get a lesson by id
Lesson not found
Invalid id provided
Response Content-Types: application/json
Response Example (200 OK)
{
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"title": "عدّ الأرقام الصغيرة",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "عدّ الأرقام الصغيرة",
"created_at": "2018-12-03T09:05:50.000Z",
"updated_at": "2018-12-03T09:05:50.000Z",
"enabled": false,
"weight": 1,
"tags": [
"عدّ الأرقام الصغيرة"
],
"youtube_video_id": "2345678901",
"description": "عدّ الأرقام الصغيرة",
"sub_section_id": "0f6c6cd4-3379-45be-a28a-d05d2ae010ba"
}
Response Example (404 Not Found)
{
"message": "lesson not found"
}
Response Example (422 Unprocessable Entity)
Sections & Subsections
GET /category/{categoryId}/sections
Get sections by category
Sections associated with a category id
Get the sections associated with the category
Invalid id provided
Response Content-Types: application/json
Response Example (200 OK)
[
{
"id": "5cf46551-b699-44ca-94c5-025e86685e32",
"title": "العد",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "العد",
"created_at": "2018-12-03T09:05:50.000Z",
"updated_at": "2018-12-03T09:05:50.000Z",
"enabled": false,
"weight": 0,
"tags": [
"العد"
],
"category_id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942"
}
]
Response Example (422 Unprocessable Entity)
GET /section/{sectionId}
Get a section by Id
Get a section by id
Get associated data.
- If you use
/section/{sectionId}/with:sub_sections
, you will get an array of sub_section for the section - If you use
/section/{sectionId}/with:lessons
, you will get sub_section with lessons inside for the section.
Get a section by id
Entity not found
Invalid id provided
Response Content-Types: application/json
Response Example (200 OK)
{
"id": "5cf46551-b699-44ca-94c5-025e86685e32",
"title": "العد",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "العد",
"created_at": "2018-12-03T09:05:50.000Z",
"updated_at": "2018-12-03T09:05:50.000Z",
"enabled": false,
"weight": 0,
"tags": [
"العد"
],
"category_id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942"
}
Response Example (404 Not Found)
{
"message": "Entity not found"
}
Response Example (422 Unprocessable Entity)
GET /section/slug/{sectionSlug}
Get a section by slug
Get a section by slug
Get associated data.
- If you use
/section/{sectionId}/with:sub_sections
, you will get an array of sub_section for the section - If you use
/section/{sectionId}/with:lessons
, you will get sub_section with lessons inside for the section.
Get a section by slug
Entity not found
Response Content-Types: application/json
Response Example (200 OK)
{
"id": "5cf46551-b699-44ca-94c5-025e86685e32",
"title": "العد",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "العد",
"created_at": "2018-12-03T09:05:50.000Z",
"updated_at": "2018-12-03T09:05:50.000Z",
"enabled": false,
"weight": 0,
"tags": [
"العد"
],
"category_id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942"
}
Response Example (404 Not Found)
{
"message": "Entity not found"
}
GET /subsection/{subsectionId}
Get a subsection by id
Get a subsection by Id
Get associated data.
- If you use
/subsection/{subsectionId}/with:lessons
, you will get an array of lessons inside the subsection object.
Get a subsection by id
Entity not found
Invalid id provided
Response Content-Types: application/json
Response Example (200 OK)
{
"id": "0f6c6cd4-3379-45be-a28a-d05d2ae010ba",
"title": "الأعداد من 0 إلى 120",
"title_en": "English Title",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "الأعداد من 0 إلى 120",
"created_at": "2018-12-03T09:04:42.000Z",
"updated_at": "2018-12-03T09:04:42.000Z",
"weight": 0,
"enabled": true,
"youtube_playlist_id": "1234567890"
}
Response Example (404 Not Found)
{
"message": "Entity not found"
}
Response Example (422 Unprocessable Entity)
GET /subsection/slug/{subsectionSlug}
Get a subsection by slug
Examples for slug الأعداد من 0 إلى 120
:
/subsection/slug/%D8%A7%D9%84%D8%A3%D8%B9%D8%AF%D8%A7%D8%AF+%D9%85%D9%86+0+%D8%A5%D9%84%D9%89+120
/subsection/slug/%D8%A7%D9%84%D8%A3%D8%B9%D8%AF%D8%A7%D8%AF+%D9%85%D9%86+0+%D8%A5%D9%84%D9%89+120/with:lessons
Get a section by slug
Get associated data.
- If you use
/subsection/slug/{subsectionSlug}/with:lessons
, you will get an array of lessons inside the subsection object.
Get a subsection by slug
Entity not found
Invalid id provided
Response Content-Types: application/json
Response Example (200 OK)
{
"id": "0f6c6cd4-3379-45be-a28a-d05d2ae010ba",
"title": "الأعداد من 0 إلى 120",
"title_en": "English Title",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "الأعداد من 0 إلى 120",
"created_at": "2018-12-03T09:04:42.000Z",
"updated_at": "2018-12-03T09:04:42.000Z",
"weight": 0,
"enabled": true,
"youtube_playlist_id": "1234567890"
}
Response Example (404 Not Found)
{
"message": "not_found"
}
Response Example (422 Unprocessable Entity)
Watchlist
GET /watchlist
returns an array of all the lessons to watch later. The watchlist is like a bookmark feature for lessons.
Response Content-Types: application/json
Response Example (200 OK)
[
{
"id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942",
"created_at": "2019-01-22T05:07:01.079Z",
"lesson_": {
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"title": "عدّ الأرقام الصغيرة",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "عدّ الأرقام الصغيرة",
"created_at": "2018-12-03T09:05:50.000Z",
"updated_at": "2018-12-03T09:05:50.000Z",
"enabled": false,
"weight": 1,
"tags": [
"عدّ الأرقام الصغيرة"
],
"youtube_video_id": "2345678901",
"description": "عدّ الأرقام الصغيرة",
"sub_section_id": "0f6c6cd4-3379-45be-a28a-d05d2ae010ba"
}
}
]
POST /watchlist/{lessonId}
Add a lesson to the watchlist
Add a lesson successfully
The lesson id does not exist
Response Content-Types: application/json
Response Example (200 OK)
{
"message": "ok"
}
Response Example (422 Unprocessable Entity)
{
"message": "entity_not_found"
}
DELETE /watchlist/{lessonId}
Deletes a lesson from the watchlist
Add a lesson successfully
Response Content-Types: application/json
Response Example (200 OK)
{
"message": "ok"
}
Gamification
GET /leaderboard/global
Returns the 100 best players by number of points. Sorted by best player first
Returns the 100 best players by number of points. Sorted by best player first
Response Content-Types: application/json
Response Example (200 OK)
[
{
"points": 15,
"first_name": "John",
"last_name": "Doe",
"nickname": "TheGreatPlayer42",
"grade": {
"id": "64c80d38-e50f-4f39-a089-7bb613223ffc",
"name_en": "Beginner",
"name_ar": "مبتدئ",
"points": 10
}
}
]
GET /leaderboard/by-country
Returns the best players per country, also returns the countries without any players
Returns the best players per country, also returns the countries without any players
Response Content-Types: application/json
Response Example (200 OK)
[
{
"id": "d162b927-912e-490d-bae6-e14dab16abf3",
"country_": {
"id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942",
"code": "TD",
"name_en": "Chad",
"name_ar": "تشاد"
},
"users": [
{
"id": "d162b927-912e-490d-bae6-e14dab16abf3",
"points": 10,
"first_name": "John",
"last_name": "Doe",
"nickname": "TheGreatPlayer42",
"grade": {
"id": "64c80d38-e50f-4f39-a089-7bb613223ffc",
"name_en": "Beginner",
"name_ar": "مبتدئ",
"points": 10
}
}
]
}
]
GET /leaderboard/by-category
Returns the best players per category
Returns the best players per category, also returns the category without any players.
Response Content-Types: application/json
Response Example (200 OK)
[
{
"id": "d162b927-912e-490d-bae6-e14dab16abf3",
"category_": {
"id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942",
"title": "الرياضيات",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "الرياضيات",
"created_at": "2018-12-03T09:04:42.000Z",
"updated_at": "2018-12-03T09:04:42.000Z",
"enabled": true,
"weight": 0,
"tags": [
"toto"
]
},
"users": [
{
"points": 10,
"id": "d162b927-912e-490d-bae6-e14dab16abf3",
"first_name": "John",
"last_name": "Doe",
"nickname": "TheGreatPlayer42",
"grade": {
"id": "64c80d38-e50f-4f39-a089-7bb613223ffc",
"name_en": "Beginner",
"name_ar": "مبتدئ",
"points": 10
}
}
]
}
]
GET /daily/lesson
returns the daily lesson
The daily lesson
Response Content-Types: application/json
Response Example (200 OK)
{
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"title": "عدّ الأرقام الصغيرة",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "عدّ الأرقام الصغيرة",
"created_at": "2018-12-03T09:05:50.000Z",
"updated_at": "2018-12-03T09:05:50.000Z",
"enabled": false,
"weight": 1,
"tags": [
"عدّ الأرقام الصغيرة"
],
"youtube_video_id": "2345678901",
"description": "عدّ الأرقام الصغيرة",
"sub_section_id": "0f6c6cd4-3379-45be-a28a-d05d2ae010ba"
}
GET /badges/mine
returns a list of the badges won by the user
returns a list of the badges won by the user
Response Example (200 OK)
[
{
"id": "64c80d38-e50f-4f39-a089-7bb613223ffc",
"name_en": "Learning Badge",
"name_ar": "شارة التعلم",
"gamification_badges": [
{
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"description_en": "daily badge",
"description_ar": "شارة اليومية",
"name_en": "daily badge",
"name_ar": "شارة اليومية"
}
]
}
]
GET /badges/by-category
returns the total list of badges by category
returns the total list of badges by category
Response Content-Types: application/json
Response Example (200 OK)
[
{
"id": "64c80d38-e50f-4f39-a089-7bb613223ffc",
"name_en": "Learning Badge",
"name_ar": "شارة التعلم",
"gamification_badges": [
{
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"description_en": "daily badge",
"description_ar": "شارة اليومية",
"name_en": "daily badge",
"name_ar": "شارة اليومية"
}
]
}
]
GET /badges
returns the total list of badges with the category associated
Response Content-Types: application/json
Response Example (200 OK)
[
{
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"description_en": "daily badge",
"description_ar": "شارة اليومية",
"name_en": "daily badge",
"name_ar": "شارة اليومية",
"category_": {
"id": "64c80d38-e50f-4f39-a089-7bb613223ffc",
"name_en": "Learning Badge",
"name_ar": "شارة التعلم"
}
}
]
GET /points/history
returns the total history of the points earned
Response Content-Types: application/json
Response Example (200 OK)
[
{
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"point": 10,
"action": "video_completed",
"created_at": "018-12-03T09:04:42.000Z"
}
]
GET /points/total
returns the total number of points
returns the total number of points
Response Content-Types: application/json
Response Example (200 OK)
{
"total": 50,
"current_grade": {
"id": "64c80d38-e50f-4f39-a089-7bb613223ffc",
"name_en": "Beginner",
"name_ar": "مبتدئ",
"points": 10
},
"grades": [
{
"id": "64c80d38-e50f-4f39-a089-7bb613223ffc",
"name_en": "Beginner",
"name_ar": "مبتدئ",
"points": 10
}
]
}
Schema Definitions
Grade: object
- id: string
- name_en: string
- name_ar: string
- points: number
Example
{
"id": "64c80d38-e50f-4f39-a089-7bb613223ffc",
"name_en": "Beginner",
"name_ar": "مبتدئ",
"points": 10
}
BadgeCategory: object
- id: string
- name_en: string
- name_ar: string
- gamification_badges: object[]
-
object - id: string
- description_en: string
- description_ar: string
- name_en: string
- name_ar: string
Example
{
"id": "64c80d38-e50f-4f39-a089-7bb613223ffc",
"name_en": "Learning Badge",
"name_ar": "شارة التعلم",
"gamification_badges": [
{
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"description_en": "daily badge",
"description_ar": "شارة اليومية",
"name_en": "daily badge",
"name_ar": "شارة اليومية"
}
]
}
Badge: object
- id: string
- description_en: string
- description_ar: string
- name_en: string
- name_ar: string
- category_: object
-
- id: string
- name_en: string
- name_ar: string
Example
{
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"description_en": "daily badge",
"description_ar": "شارة اليومية",
"name_en": "daily badge",
"name_ar": "شارة اليومية",
"category_": {
"id": "64c80d38-e50f-4f39-a089-7bb613223ffc",
"name_en": "Learning Badge",
"name_ar": "شارة التعلم"
}
}
Point: object
- id: string
- point: number
- action: string
- created_at: string
Example
{
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"point": 10,
"action": "video_completed",
"created_at": "018-12-03T09:04:42.000Z"
}
Profile: object
Example
{
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"first_name": "John",
"last_name": "Doe",
"date_of_birth": "1991-07-30",
"gender": "female",
"city": "Nancy",
"type": "student",
"updated_at": "2018-12-03T09:04:42.000Z",
"nationality_": {
"id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942",
"code": "TD",
"name_en": "Chad",
"name_ar": "تشاد"
},
"country_of_residence_": {
"id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942",
"code": "TD",
"name_en": "Chad",
"name_ar": "تشاد"
}
}
Lesson: object
- id: string
- title: string
- icon_url: string
- slug: string
- created_at: string
- updated_at: string
- enabled: boolean
- weight: number
- tags: string[]
-
string - youtube_video_id: string
- description: string
- sub_section_id: string
Example
{
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"title": "عدّ الأرقام الصغيرة",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "عدّ الأرقام الصغيرة",
"created_at": "2018-12-03T09:05:50.000Z",
"updated_at": "2018-12-03T09:05:50.000Z",
"enabled": false,
"weight": 1,
"tags": [
"عدّ الأرقام الصغيرة"
],
"youtube_video_id": "2345678901",
"description": "عدّ الأرقام الصغيرة",
"sub_section_id": "0f6c6cd4-3379-45be-a28a-d05d2ae010ba"
}
VideoActivity: object
- id: string
- type: string
- lesson_: Lesson
Example
{
"id": "5cf46551-b699-44ca-94c5-025e86685e32",
"type": "completed",
"lesson_": {
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"title": "عدّ الأرقام الصغيرة",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "عدّ الأرقام الصغيرة",
"created_at": "2018-12-03T09:05:50.000Z",
"updated_at": "2018-12-03T09:05:50.000Z",
"enabled": false,
"weight": 1,
"tags": [
"عدّ الأرقام الصغيرة"
],
"youtube_video_id": "2345678901",
"description": "عدّ الأرقام الصغيرة",
"sub_section_id": "0f6c6cd4-3379-45be-a28a-d05d2ae010ba"
}
}
Section: object
- id: string
- title: string
- icon_url: string
- slug: string
- created_at: string
- updated_at: string
- enabled: boolean
- weight: number
- tags: string[]
-
string - category_id: string
Example
{
"id": "5cf46551-b699-44ca-94c5-025e86685e32",
"title": "العد",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "العد",
"created_at": "2018-12-03T09:05:50.000Z",
"updated_at": "2018-12-03T09:05:50.000Z",
"enabled": false,
"weight": 0,
"tags": [
"العد"
],
"category_id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942"
}
Subsection: object
- id: string
- title: string
- title_en: string
- icon_url: string
- slug: string
- created_at: string
- updated_at: string
- weight: number
- enabled: boolean
- youtube_playlist_id: string
Example
{
"id": "0f6c6cd4-3379-45be-a28a-d05d2ae010ba",
"title": "الأعداد من 0 إلى 120",
"title_en": "English Title",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "الأعداد من 0 إلى 120",
"created_at": "2018-12-03T09:04:42.000Z",
"updated_at": "2018-12-03T09:04:42.000Z",
"weight": 0,
"enabled": true,
"youtube_playlist_id": "1234567890"
}
Answer: object
- id: string
- created_at: string
- value: strng
Example
{
"id": "d19fbe0a-bd03-4fdc-9adb-2c99f6999215",
"created_at": "2019-01-22T05:07:01.092Z",
"value": "hello"
}
Watchlist: object
- id: string
-
watchlist database id as uuid
example: f30d83b1-69d9-4edd-94a7-9c5003cd0942
- created_at: string
-
The date the lesson has been added to the watchlist
example 2019-01-22T05:07:01.079Z
- lesson_: Lesson
Example
{
"id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942",
"created_at": "2019-01-22T05:07:01.079Z",
"lesson_": {
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"title": "عدّ الأرقام الصغيرة",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "عدّ الأرقام الصغيرة",
"created_at": "2018-12-03T09:05:50.000Z",
"updated_at": "2018-12-03T09:05:50.000Z",
"enabled": false,
"weight": 1,
"tags": [
"عدّ الأرقام الصغيرة"
],
"youtube_video_id": "2345678901",
"description": "عدّ الأرقام الصغيرة",
"sub_section_id": "0f6c6cd4-3379-45be-a28a-d05d2ae010ba"
}
}
Question: object
- id: string
-
question id as uuid
example: f30d83b1-69d9-4edd-94a7-9c5003cd0942
- created_at: string
-
The date the question has been created
example 2019-01-22T05:07:01.079Z
- order: number
- status: string
- type: string
- value: string
- begin_at: string
- end_at: string
- answer_type: string
-
The type of question, 'mcq' means multiple choice question, it's the only value supported for now
- answers: Answer
-
Answer - lessson_: Lesson
Example
{
"id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942",
"created_at": "2019-01-22T05:07:01.079Z",
"order": 1,
"status": "current",
"type": "text",
"value": "اشترى سمير تفاحًا وموزًا من البقالّة. إذا علمت أنّ ثمن التفاح 25.85 درهمًا والموز 20.655 درهمًا، وأنّ قيمة الضريبة المضافة عليهما معًا تبلغ 2.3 درهمًا، كم يجب أن يدفع سمير لصاحب البقالة؟",
"begin_at": "2019-01-22T00:00:00.000Z",
"end_at": "2019-01-23T00:00:00.000Z",
"answer_type": "mcq",
"answers": [
{
"id": "d19fbe0a-bd03-4fdc-9adb-2c99f6999215",
"created_at": "2019-01-22T05:07:01.092Z",
"value": "hello"
}
],
"lessson_": {
"id": "6f3d0648-37eb-4d5a-b7a0-86e63a1bdc53",
"title": "عدّ الأرقام الصغيرة",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "عدّ الأرقام الصغيرة",
"created_at": "2018-12-03T09:05:50.000Z",
"updated_at": "2018-12-03T09:05:50.000Z",
"enabled": false,
"weight": 1,
"tags": [
"عدّ الأرقام الصغيرة"
],
"youtube_video_id": "2345678901",
"description": "عدّ الأرقام الصغيرة",
"sub_section_id": "0f6c6cd4-3379-45be-a28a-d05d2ae010ba"
}
}
Country: object
- id: string
- code: string
- name_en: string
- name_ar: string
Example
{
"id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942",
"code": "TD",
"name_en": "Chad",
"name_ar": "تشاد"
}
Category: object
- id: string
- title: string
- icon_url: string
- slug: string
- created_at: string
- updated_at: string
- enabled: boolean
- weight: number
- tags: string[]
-
string
Example
{
"id": "f30d83b1-69d9-4edd-94a7-9c5003cd0942",
"title": "الرياضيات",
"icon_url": "https://madrasa.org/wp-content/themes/education_v2/imgs/vidLib/15.png",
"slug": "الرياضيات",
"created_at": "2018-12-03T09:04:42.000Z",
"updated_at": "2018-12-03T09:04:42.000Z",
"enabled": true,
"weight": 0,
"tags": [
"toto"
]
}