Fork me on GitHub

In the context of API, the course – which is known as major in US university system – is referred as course. It is the main entity of Redu hierarchy, being a self-contained entity of content and users. That is, users who have access to a course will be allowed to view all of its spaces, subjects, and classes.

GET /api/courses/:id

Returns the course in question.

Authorization

You must be enrolled in the course to view this resource.

Parameters

Parameter Description Restrictions
id Course ID N/A

Example

Request:

GET /api/environments/462

Response:

{
  "workload": 40,
    "links": [
    {
      "href": "http://www.redu.com.br/api/courses/pacote-web",
      "rel": "self"
    },
    {
      "href": "http://www.redu.com.br/api/courses/pacote-web/spaces",
      "rel": "spaces"
    },
    {
      "href": "http://www.redu.com.br/api/environments/guiocavalcanti",
      "rel": "environment"
    },
    {
      "href": "http://www.redu.com.br/api/courses/pacote-web/enrollments",
      "rel": "enrollments"
    }
  ],
    "name": "Pacote Web",
    "description": "O foco é estudar os conceitos e tecnologias utilizadas no desenvolvimento da parte da Web que funciona dentro do navegador.",
    "created_at": "2012-01-13T12:11:22-02:00",
    "id": 462,
    "path": "pacote-web"
}

POST /api/environments/:environment_id/courses

Creates a new course in the specified environment. In Redu, the enrollment is done within the course. That is, users who have access to a course can also view its spaces, subjects, and classes.

Authorization

To create a Course you need to have administrative role in the environment.

Parameters

Parameter Description Restrictions
environment_id ID or path to environment N/A
course[name] Course name Maximum 40 characters; it must be unique
course[path] Name that will appear in the address bar It must fit the following regex: ^[-_A-Za-z0-9]*$; It must be unique within an environment
course[description] Course description Maximum 400 characters
course[workload] Workload of the course in hours It must be numeric

Example

Request:

POST /api/environments/foo/courses

Payload:

{
  "course" :
  {
    "name" : "meu novo curso",
      "path" : "meu-novo-curso",
  }
}

Response:

{
  "links": [
  {
    "href": "http://www.redu.com.br/api/courses/meu-novo-curso",
      "rel": "self"
  },
  {
    "href": "http://www.redu.com.br/api/courses/meu-novo-curso/spaces",
    "rel": "spaces"
  },
  {
    "href": "http://www.redu.com.br/api/environments/www",
    "rel": "environment"
  },
  {
    "href": "http://www.redu.com.br/api/courses/meu-novo-curso/enrollments",
    "rel": "enrollments"
  }
  ],
    "name": "meu novo curso",
    "created_at": "2012-09-10T09:28:09-03:00",
    "id": 1137,
    "path": "meu-novo-curso"
}

PUT /api/courses/:id

Updates information for the specified course. It is important to notice that there is no protection against path update. That is, some application can access this feature by using the path and, if it is changed, the HTTP code 404 (not found) will be returned.

Authorization

To create a Course you need to have administrative role in the environment.

Parameters

Parameter Description Restrictions
course[name] Course name Maximum 40 characters; it must be unique
course[path] Name that will show up in the address bar It must fit the following regex: ^[-_A-Za-z0-9]*$; It must be unique within an environment
course[description] Course description Maximum 400 characters
course[workload] Workload of the course in hours It must be numeric

GET /api/environments/:environment_id/courses

Returns a list of courses created within the environment in question.

Authorization

You must be enrolled in at least one Course of the environment.

Parameters

Parameter Description Restrictions
environment_id ID or path to environment N/A

Example

Request: GET /api/environments/guiocavalcanti/courses

Response:

[
{
  "workload": 40,
    "links": [
    {
      "href": "http://www.redu.com.br/api/courses/pacote-web",
      "rel": "self"
    },
    {
      "href": "http://www.redu.com.br/api/courses/pacote-web/spaces",
      "rel": "spaces"
    },
    {
      "href": "http://www.redu.com.br/api/environments/guiocavalcanti",
      "rel": "environment"
    },
    {
      "href": "http://www.redu.com.br/api/courses/pacote-web/enrollments",
      "rel": "enrollments"
    }
  ],
    "name": "Pacote Web",
    "description": "O foco é estudar os conceitos e tecnologias utilizadas no desenvolvimento da parte da Web que funciona dentro do navegador.",
    "created_at": "2012-01-13T12:11:22-02:00",
    "id": 462,
    "path": "pacote-web"
},
{
  "workload": 40,
  "links": [
  {
    "href": "http://www.redu.com.br/api/courses/pacote-web-2012-2",
    "rel": "self"
  },
  {
    "href": "http://www.redu.com.br/api/courses/pacote-web-2012-2/spaces",
    "rel": "spaces"
  },
  {
    "href": "http://www.redu.com.br/api/environments/guiocavalcanti",
    "rel": "environment"
  },
  {
    "href": "http://www.redu.com.br/api/courses/pacote-web-2012-2/enrollments",
    "rel": "enrollments"
  }
  ],
    "name": "Pacote Web 2012-2",
    "description": "O foco é estudar os conceitos e tecnologias utilizadas no desenvolvimento da parte da Web que funciona dentro do navegador.",
    "created_at": "2012-07-16T21:39:02-03:00",
    "id": 968,
    "path": "pacote-web-2012-2"
}
]

DELETE /api/courses/:id

Deletes the course in question. All the users will be unregistered, and lose access to the resource.

Authorization

To create a Course you need to have administrative role in the environment.

Parameters

Parameter Description Restrictions
id ID or path to environment N/A