Skip to content

Latest commit

 

History

History
343 lines (248 loc) · 3.72 KB

programs.md

File metadata and controls

343 lines (248 loc) · 3.72 KB

Programs


Create a program

api.ayat.com/v1/programs Post

Payload
{
  "JWT": "fg5562ase84c4",

  "program_name": "<Name example>",

  "prerequisite": [
    {
      "name": "name example"
    },
    {
      "name": "name example"
    }
  ],
  "program_level": "<Difficulty>",

  "program_category": [
    {
      "type": "example"
    },
    {
      "type": "example"
    }
  ],

  "price": "$$$",

  "program_pic": "<Local Pic>",

  "FAQ": [
    {
      "question": "Text",
      "answer": "Text"
    },
    {
      "question": "Text",
      "answer": "Text"
    }
  ],

  "program_cover": "<Local pic>",

  "Program_description": "text example",

  "available": "<true as a default boolean value>"
}
Success response:
code: 200
{
  "status": "created"
}

Error responce :

code: 403
{
  "status": "Forbidden"
}

Edit a program

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

Payload
{
  "JWT": "adfgv5erw85s3",
  "program_name": "name example",

  "prerequisite": [
    {
      "type": "example"
    },
    {
      "type": "example"
    }
  ],
  "program_level": "<Difficulty>",

  "program_category": [
    {
      "type": "example"
    },
    {
      "type": "example"
    }
  ],

  "price": "$$$",

  "program_pic": "<Local Pic>",

  "FAQ": [
    {
      "question": "Text",
      "answer": "Text"
    },
    {
      "question": "Text",
      "answer": "Text"
    }
  ],

  "program_cover": "<Local pic>",

  "Program_description": "text example",

  "available": "<true as a default boolean value>"
}

Success responce:

code: 200

{
  "status": "edited"
}

Error responce:

code: 403
{
  "status": "Forbidden"
}

How to Retrieve a program

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

Payload
{}

Success responce:

code: 200
{
  "program_name": "name example",

  "prerequisite": [
    {
      "type": "example"
    },
    {
      "type": "example"
    }
  ],
  "program_level": "<Difficulty>",

  "program_category": [
    {
      "type": "example"
    },
    {
      "type": "example"
    }
  ],

  "price": "$$$",

  "program_pic": "<Local Pic>",

  "FAQ": [
    {
      "question": "Text",
      "answer": "Text"
    },
    {
      "question": "Text",
      "answer": "Text"
    }
  ],

  "program_cover": "<Local pic>",

  "Program_description": "text example",

  "available": "<true as a default boolean value>"
}

Error responce:

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

Delete a program

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

Payload
{
  "JWT": "adfgv5erw85s3",
}

Success responce:

code: 200
{
  "status": "Deleted"
}

Error responce:

code: 403
{
  "status": "Forbidden"
}

Subscribe to a program

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

Payload
{
  "JWT": "adfgv5erw85s3",
  "public_program_id": "{id}"
}

Success responce:

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

Error responce:

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

or

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

Cancel subscription to a program

api.ayat.com/v1/programs/{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"
}