Introduction

  • Created on: 07 July 2021
  • Backend: Laravel 8.57(current) (start with (8.49) )
  • Frontend: Angular

Http Code

  • 200 - (OK) REST API successfully carried out
  • 201 (Created) The request has been fulfilled and new resource being created.
  • 202 (Accepted) It indicates that the request has been accepted for processing, but the processing has not been completed
  • 204 (No Content) This code means that the server has successfully processed the request, but is not going to return any content.
  • 400 (Bad Request) Errors can be like malformed request syntax, invalid request message parameters, or deceptive request routing etc.
  • 401 (Unauthorized) Protected resource without providing the proper authorization
  • 403 (Forbidden) User does not have the necessary permissions for the resource
  • 404 (Not Found) REST API can’t map the client’s URI
  • 405 (Method Not Allowed) The client tried to use an HTTP method that the resource does not allow
  • 406 (Not Acceptable) API is not able to generate any of the client’s preferred media types, as indicated by the Accept request header. For example, a client request for data formatted as application/xml will receive a 406 response if the API is only willing to format data as application/json.
  • 408 Request Timeout
  • 422 Unprocessable Entity(Validation error)
  • 500 Internal Server Error

Configuration

Step 1: Migrate tables to database

php artisan migrate  --seed

OR

php artisan migrate:fresh  --seed

Step 2: Install passport

php artisan passport:install

Only clear the cache: php artisan config:clear and php artisan cache:clear.

Apis

We've used the following apis as listed.Click on Api to copy.

Process Method Api Fields
Http code check POST https://api.testpal.com.au/api/v1/http/{code}
Login user POST https://api.testpal.com.au/api/v1/login username,password,role_id
Logout user POST https://api.testpal.com.au/api/v1/logout
Create a category POST https://api.testpal.com.au/api/v1/category category_name
Fetch all categories GET https://api.testpal.com.au/api/v1/category
Fetch a category GET https://api.testpal.com.au/api/v1/category/{slug}
Update a category PUT https://api.testpal.com.au/api/v1/category/{slug} category_name,active
Delete a category DELETE https://api.testpal.com.au/api/v1/category/{slug}
Create a subject POST https://api.testpal.com.au/api/v1/subject category_id,subject_name,description
Fetch all subjects GET https://api.testpal.com.au/api/v1/subject
Fetch a subject GET https://api.testpal.com.au/api/v1/subject/{slug}
Update a subject PUT https://api.testpal.com.au/api/v1/subject category_id,subject_name,description,active
Delete a subject DELETE https://api.testpal.com.au/api/v1/subject/{slug}
Create a topic POST https://api.testpal.com.au/api/v1/topic subject_id,label
Fetch all topic GET https://api.testpal.com.au/api/v1/topic
Fetch a topic GET https://api.testpal.com.au/api/v1/topic/{slug}
Update a topic PUT https://api.testpal.com.au/api/v1/topic/{slug} subject_id,label,active
Delete a topic DELETE https://api.testpal.com.au/api/v1/topic/{slug}
Create a sub topic POST https://api.testpal.com.au/api/v1/subtopic topic_id,sub_topic
Fetch all sub topics GET https://api.testpal.com.au/api/v1/subtopic
Fetch a sub topic GET https://api.testpal.com.au/api/v1/subtopic/{slug}
Update a sub topic PUT https://api.testpal.com.au/api/v1/subtopic/{slug} topic_id,sub_topic,active
Delete a sub topic DELETE https://api.testpal.com.au/api/v1/subtopic/{slug}
Fetch all question type GET https://api.testpal.com.au/api/v1/question_type
Create a test POST https://api.testpal.com.au/api/v1/test title,description,subject_id,
test_type_id,duration,right_answer_mark,
wrong_answer_mark,unattempt_mark_answer,paid
Fetch all test GET https://api.testpal.com.au/api/v1/test
Fetch a test GET https://api.testpal.com.au/api/v1/test/{slug}
Delete a test DELETE https://api.testpal.com.au/api/v1/test/{slug}
Update a test POST https://api.testpal.com.au/api/v1/test/{slug} title,description,subject_id,
test_type_id,duration,right_answer_mark,
wrong_answer_mark,unattempt_mark_answer,paid,active
Fetch all product type GET https://api.testpal.com.au/api/v1/product_type
Fetch all test type GET https://api.testpal.com.au/api/v1/test_type
Fetch all test mode GET https://api.testpal.com.au/api/v1/test_mode
Fetch all product mode GET https://api.testpal.com.au/api/v1/product_mode
Create a product POST https://api.testpal.com.au/api/v1/product title,description,duration,price,category_id,
product_details['product_type_id','test_or_service_id']
Fetch all product GET https://api.testpal.com.au/api/v1/product
Update a product PUT https://api.testpal.com.au/api/v1/product/{slug} title,description,duration,price,category_id,
product_details['product_type_id','test_or_service_id']
Fetch a product GET https://api.testpal.com.au/api/v1/product/{slug}
Delete a product DELETE https://api.testpal.com.au/api/v1/product/{slug}
Create passage POST https://api.testpal.com.au/api/v1/passage passage
Fetch all passages GET https://api.testpal.com.au/api/v1/passage
Fetch a passage GET https://api.testpal.com.au/api/v1/passage/{slug}
Delete a passage DELETE https://api.testpal.com.au/api/v1/passage/{slug}
Update a passage PUT https://api.testpal.com.au/api/v1/passage passage
Create question POST https://api.testpal.com.au/api/v1/question passage_status,passage_id,test_id,
topic_id, sub_topic_id,question,complexity,
options[option,option_image,is_answer,order],
solution,reference,remarks,image,solution_image
Fetch all questions GET https://api.testpal.com.au/api/v1/question
Fetch a question GET https://api.testpal.com.au/api/v1/question/{slug}
Delete a question DELETE https://api.testpal.com.au/api/v1/question/{slug}
Update a question PUT https://api.testpal.com.au/api/v1/question/{slug} passage_status,passage_id,test_id,
topic_id, sub_topic_id,question,complexity,
solution,reference,remarks,image,solution_image
Fetch all question under test GET https://api.testpal.com.au/api/v1/question/test/{test_slug}
Fetch all question with or without passage GET https://api.testpal.com.au/api/v1/question/passage/{yes|no}
Update option Updated POST https://api.testpal.com.au/api/v1/update/option/{option_slug} option,option_image(optional),order,is_answer
Update product order POST https://api.testpal.com.au/api/v1/product_order_change products['slug','order']
Upload question POST https://api.testpal.com.au/api/v1/upload/question excel,image
Create option New POST https://api.testpal.com.au/api/v1/option question_id,option,option_image(optional),order,is_answer
Delete option New DELETE https://api.testpal.com.au/api/v1/option/{slug}
Update question POST https://api.testpal.com.au/api/v1/update/question/{slug} passage_status,passage_id,test_id,
topic_id, sub_topic_id,question,complexity,
solution,reference,remarks,image,solution_image
Parent/teacher signup POST https://api.testpal.com.au/api/v1/parent/registration email_verified,role_id,parent_name,mobile_number,email,
parent_password,student_name,student_password,
student_username,student_grade
Create news POST https://api.testpal.com.au/api/v1/news title,image,content
Update news POST https://api.testpal.com.au/api/v1/news/{slug} title,image,content
Fetch all news GET https://api.testpal.com.au/api/v1/news
Delete news DELETE https://api.testpal.com.au/api/v1/news/{slug}
Create and update about POST https://api.testpal.com.au/api/v1/about title,content
Fetch about GET https://api.testpal.com.au/api/v1/about

Front-End APIs

Process Method Api Fields
Send OTP POST https://api.testpal.com.au/api/v1/send_otp email
Verify OTP POST https://api.testpal.com.au/api/v1/verify_otp email,otp
Login student/parent POST https://api.testpal.com.au/api/v1/parent/login username,password,active,role_id
List categories GET https://api.testpal.com.au/api/v1/user/category
View products GET https://api.testpal.com.au/api/v1/user/{category_slug}/products
Buy product POST https://api.testpal.com.au/api/v1/user/purchase/product product,package
List purchased product GET https://api.testpal.com.au/api/v1/user/purchase/product
Purchase history GET https://api.testpal.com.au/api/v1/user/purchase/history
Fetch test under product GET https://api.testpal.com.au/api/v1/user/test/{product_slug}
Fetch test types GET https://api.testpal.com.au/api/v1/user/test_type
Purchased test GET https://api.testpal.com.au/api/v1/user/purchase/test
Fetch question POST https://api.testpal.com.au/api/v1/user/test/{test_slug}/question paragraph(boolean)
count,random(boolean),complexity
Fetch learn questions POST https://api.testpal.com.au/api/v1/user/test/{test_slug}/learn/question paragraph(boolean)
count,random(boolean),complexity
Fetch practice questions POST https://api.testpal.com.au/api/v1/user/test/{test_slug}/practice/question paragraph(boolean)
count,random(boolean),complexity
Fetch free test GET https://api.testpal.com.au/api/v1/user/free_test
Submit result POST https://api.testpal.com.au/api/v1/user/result test_slug,
questions[question_index,question_id,chosen_option_id,time_taken]
Result all history GET https://api.testpal.com.au/api/v1/user/result
Result history GET https://api.testpal.com.au/api/v1/user/result/{exam_id}
Fetch analysis report GET https://api.testpal.com.au/api/v1/user/result/{exam_id}/analysis
Get current user data GET https://api.testpal.com.au/api/v1/user
Add new student POST https://api.testpal.com.au/api/v1/user/student name,username,password,photo,grade^,gender^
Fetch all student details GET https://api.testpal.com.au/api/v1/user/student
Update a student POST https://api.testpal.com.au/api/v1/user/student/{child_id} name,photo,grade^,gender^
Change password POST https://api.testpal.com.au/api/v1/user/password/change old_password,new_password
Progress report GET https://api.testpal.com.au/api/v1/user/progress_report
Student exam history category wise POST https://api.testpal.com.au/api/v1/user/student/exam/history category_id,student_id
Fetch analysis report POST https://api.testpal.com.au/api/v1/user/result/{exam_id}/analysis/student student_id
Change student password POST https://api.testpal.com.au/api/v1/user/change_password/student student_id,password
Category wise free test GET https://api.testpal.com.au/api/v1/user/category_wise_free_test/{category_slug}
Fetch all student GET https://api.testpal.com.au/api/v1/user/student
Fetch all parent GET https://api.testpal.com.au/api/v1/user/parent
Add new testimonial POST https://api.testpal.com.au/api/v1/testimonial name,designation,content,image
Update testimonial POST https://api.testpal.com.au/api/v1/testimonial/{slug} name,designation,content,image^
Get testimonial GET https://api.testpal.com.au/api/v1/testimonial
Delete testimonial DELETE https://api.testpal.com.au/api/v1/testimonial/{slug}
Add slider New POST https://api.testpal.com.au/api/v1/slider heading,image,content
Fetch all slider New GET https://api.testpal.com.au/api/v1/slider
Delete slider New DELETE https://api.testpal.com.au/api/v1/slider/{slug}
Update slider New POST https://api.testpal.com.au/api/v1/slider/{slug} heading,image^,content
Create new blog category POST https://api.testpal.com.au/api/v1/blog_category name,active
Update blog category PUT https://api.testpal.com.au/api/v1/blog_category/{slug} name,active
Fetch all blog category GET https://api.testpal.com.au/api/v1/blog_category/{slug}
Add blog New POST https://api.testpal.com.au/api/v1/blog heading,image,content,blog_category_id
Update blog New POST https://api.testpal.com.au/api/v1/blog/{slug} heading,image^,content,blog_category_id
Delete blog New DELETE https://api.testpal.com.au/api/v1/blog/{slug}
Fetch blog New GET https://api.testpal.com.au/api/v1/blog
Dashboard data GET https://api.testpal.com.au/api/v1/dashboard