Skip to content

Latest commit

 

History

History
418 lines (287 loc) · 4.27 KB

recitations.md

File metadata and controls

418 lines (287 loc) · 4.27 KB

Recitations


Note: for creating, updating and deleting recitation user must have admin permissions.

Creating a new recitation

api.ayat.com/v1/recitations POST

Payload:
{
  "jwt": "ffff",
  "recitation_name": "Title",
  "recitation_description": "description",
  // other recitation's data.
}
Success Response:
code: 201
{
  "status": "created"
}

or

{
    "status":  "<Duplicate resource codes: 7>"
}
Error Response:
code: 403
{
  "error": "user is unauthorized"
}

Updating recitation's data

api.ayat.com/v1/recitations/{id} PUT

Payload:
{
  "jwt": "ffff"
  // which data to be updated
}
Success Response:
code: 200
{
  "status": "updated"
}
Error Response:
code: 403
{
  "error": "user is unauthorized"
}

Retrieving recitations

api.ayat.com/v1/recitations/ GET

Payload:
{}
Success Response:
code: 200
{
  "recitation": [recitaion_ids]
}
Error Response:
code: 404
{
  "error": "Content not found"
}

Retrieving a specific recitation's data

api.ayat.com/v1/recitations/{id} GET

Payload:
{
  "jwt": "32132143432432"
}
Success Response:
code: 200
{
  //recitation data.
}
Error Response:
code: 403
{
  "error": "user is unauthorized"
}

or

code: 404
{
    "error": "Content not found"
}

Deleting a recitation

api.ayat.com/v1/recitations/{id} DELETE

Payload:
{
  "jwt": "ffff"
}
Success Response:
code: 200
{
    "status":  "deleted"
}
Error Response:
code: 403
{
  "error": "user is unauthorized"
}

Subscribe to a recitation

api.ayat.com/v1/recitations/{id}/enrollments POST

Payload
{
  "JWT": "adfgv5erw85s3"
}

Success responce:

code: 202
{
  "status": "enrolled"
}

Error responce:

{
  "error": "<Duplicate resource codes: 5>"
}

or

code: 403
{
  "error": "user is unauthorized"
}

Cancel subscription to a recitation

api.ayat.com/v1/recitations/{id}/enrollments DELETE

Payload
{
  "JWT": "adfgv5erw85s3"
}

Success responce:

code: 200
{
  "status": "success"
}

Error responce:

{
  "error": "<Duplicate resource codes: 6>"
}

or

code: 403
{
  "error": "user is unauthorized"
}

Create new assignment in a specific recitation

api.ayat.com/v1/recitations/{id}/assignments POST

Payload
{
  "JWT": "adfgv5erw85s3",
  "student_ids": [student ids]
  // Data to be added

}

Success responce:

code: 201
{
  "status": "created"
}

Error responce:

code: 403
{
  "error": "user is unauthorized"
}

update an assignment in a specific recitation

api.ayat.com/v1/recitations/{id}/assignments/{id} PUT

Payload
{
  "JWT": "adfgv5erw85s3",
  // assignment's data to be updated

}

Success responce:

code: 200
{
  "status": "success"
}

Error responce:

code: 403
{
  "error": "user is unauthorized"
}

User gets an assignment from a specific recitation

TODO

api.ayat.com/v1/recitations/{id}/assignments/filter GET

Payload
{
  "JWT": "adfgv5erw85s3"
}

Success responce:

code: 200
{
  "status": "success"
}

Error responce:

code: 403
{
  "error": "user is unauthorized"
}

Delete an assignment in a specific recitation

api.ayat.com/v1/recitations/{id}/assignments/{id} DELETE

Payload
{
  "JWT": "adfgv5erw85s3"
}

Success responce:

code: 200
{
  "status": "success"
}

Error responce:

code: 403
{
  "error": "user is unauthorized"
}