Skip to content

Subject Endpoint

Yan_Badea edited this page Sep 14, 2021 · 1 revision

Wiki ▸ Endpoints ▸ Subject

Subject

Contains data of all Subjects available on our e-learning platform.

The Subject Endpoint is a representation of the subjects added to the application. The endpoint's purpose is to facilitate accessing, creating, updating and deleting these files.

Endpoints

GET /subjects/

Retrieves all of the available subjects.

Sample Response

Status code: 200
Body:

[
  {
    "id": "cc327880f-9252-444b-94c2-b3b28c006",
    "value": "English_Literature",
  },
  {
    "id": "b3b28c006-8883-9252-914a-cc327880f",
    "value": "Calculus",
  },
]

GET /subjects/:id

Retrieves the subject with the provided id.

Parameters

Path Parameters

Path Parameter Description
:id The id of the subject entry.

Sample Response

Status code: 200
Body:

{
  "id": "b3b28c006-8883-9252-914a-cc327880f",
  "value": "Programming",
}

Status code: 404
Body:

{
    "error": "Not Found",
}

POST /subjects/

Adds an entry composed in the body as a subject. If the value attribute is null or empty, it will return an error.

Sample Response

Status code: 201
Request Body:

{
    "value": "Geography"
}

Response Body:

{
    "id": "61112f24-c44b-455a-9xxa-01ff2af1xx01",
    "value": "Geography"
}

Status code: 400
Request Body:

{
    "value":""
}

Response Body:

{
    "error": "Bad Request",
}

PATCH /subjects/:id

Sends an entity at the specified id with the subject entry that has been updated.

Parameters

Path Parameters

Path Parameter Description
:id The id of the subject entry.

Sample Response

Status code: 200
Request Body:

{
  "value": "Biology",
}

Response Body:

{
    "id": "3b28c006-8883-9252-914a-cc327880f",
    "value": "Biology"
}

Status code: 404
Request Body:

{
    "value": "Biology2"   
}

Response Body:

{
    "error": "Not Found",
}

Status code: 400
Body:

    "value":""

Response Body:

{
    "error": "Bad Request",
}

DELETE /subjects/:id

Deletes the subject with the provided id.

Parameters

Path Parameters

Path Parameter Description
:id The id of the subject entry.

Sample Response

Status code: 200
Body:

Status code: 404
Body:

{
    "error": "Not Found",
}

Getting Started

Conventions

  1. General

  1. REST API

  1. E-Learning App

Endpoints

Custom Components

Themes

Packages Used

  1. Global

  1. REST API

  1. E-Learning App

Clone this wiki locally