Link web: https://ip-mf-d750f.web.app API server: https://project.mf-cyberse.online/
List of available endpoints:
GET /pub
GET /pub/:id
POST /register
POST /login
GET /contents
POST /contents
PUT /contents/:id
DELETE /contents/:id
GET /categories
GET /categories/:id
POST /categories
PUT /categories/:id
DELETE /categories/:id
Get public data.
Response (200 - OK)
{
data: [
{
"id": "string",
"title": "string",
"translations": [Array]
},
...,
],
"meta":
{
"current_page": "1",
"last_page": 35,
"total_items": 697,
"per_page": 20
}
}
Get specific public data by Id.
-
Request Params:
{ id: integer }
Response (200-OK)
{
"id": "integer",
"title": "string",
"hadeeth": "text",
"attribution": "string",
"grade": "string",
"explanation": "text",
"hints": [Array],
"categories": [Array],
"translations": [Array]
}
Register a new user
-
Request Body
{ "username": "string", "email": "string", "password": "string" }Response (200 - OK)
{ "username": "string", "email" : "string" }
Log in an existing user
-
Request Body
{ "email": "string", "password": "string" }Response (200 - OK)
{ "accessToken": "<access_token>" }
Get all contents
- headers:
{
"Authorization": "Bearer <access_token>"
}Response (200 - OK)
[
{
"id": "integer",
"title": "string",
"description": "text",
"UserId": "integer",
"CategoryId": "integer",
"createdAt": "date",
"updatedAt": "date",
"Category": {
"id": "integer",
"name": "String",
"createdAt": "date",
"updatedAt": "date"
}
}
]
Get content by id
- headers:
{
"Authorization": "Bearer <access_token>"
}Request Params
{
"id" : "integer"
}
Response (200 - OK)
{
"title" : "string",
"description" : "text",
"CategoryId" : "integer:
}
Create a new content
- headers:
{
"Authorization": "Bearer <access_token>"
}Request Body
{
"title" : "string",
"description" : "text",
"CategoryId" : "integer:
}
Response (200 - OK)
{
"title" : "string",
"description" : "text",
"CategoryId" : "integer:
}
Update content by Id
- headers:
{
"Authorization": "Bearer <access_token>"
}Request Params
{
"id": "integer"
}
Request Body
{
"title" : "string",
"description" : "text",
"CategoryId" : "integer:
}
Response (200 - OK)
{
"title" : "string",
"description" : "text",
"CategoryId" : "integer:
}
Delete content by Id
- headers:
{
"Authorization": "Bearer <access_token>"
}Request Params
{
"id": "integer"
}
Request Body
{
"title" : "string",
"description" : "text",
"CategoryId" : "integer:
}
Response (200 - OK)
{
message: `Deleted content <content.title>`
}
Get all categories
- headers:
{
"Authorization": "Bearer <access_token>"
}Response (200 - OK)
[
{
"name": "string"
},
...,
]
Get specific category by Id
- headers:
{
"Authorization": "Bearer <access_token>"
}Request Params
{
"id" : "integer"
}
Response (200 - OK)
{
"name" : "string"
}
Create a new category (only admin)
- headers:
{
"Authorization": "Bearer <access_token>"
}Request Body
{
"name": "string"
}
Response (200 - OK)
{
"name": "string"
}
Update category by Id
- headers:
{
"Authorization": "Bearer <access_token>"
}Request Params
{
"id": "integer"
}
Request Body
{
"name": "string"
}
Response (200 - OK)
{
"name": "string"
}
Delete category by Id
- headers:
{
"Authorization": "Bearer <access_token>"
}Request Params
{
"id": "integer"
}
Request Body
{
"name": "string"
}
Response (200 - OK)
{
"name": "string"
}