NAV Navbar
Logo
Examples

Latest Updates

Changelog (last updated: 2017-05-06)

6/5/17

1/5/17

26/4/17

21/4/17

18/4/17

23/3/17

9/3/17

21/2/17

24/1/17

Introduction

This is the API documentation for CapstoneED. It can be changed between the Student’s View and the Lecturer’s view from the button at the bottol left corner. The template is forked from SLATE.

The ERD of the Database can be found below:

ERD

Query String Parameters

Includes

To avoid excess trips to the server, one can optionally get any associated records together with each resource. This is accomplished by using the includes parameter e.g. /v1/assignment?includes=unit,projects. This makes the server eager load the associated record and return them in the response. Each resource has specific association that it can include, and those may vary between Student and Lecturer. Refer to the params section of each Endpoint to see the available options for both Student and Lecturer. Each resource must be separated by comma, and the correct singular or plural form of the work must be used, depending on the nature of its relationship to the endpoint resource. For example, an Assignment has many projects, so the parametera passed should be projects, not project.

Available Associations for each Resource

Resource Available Associations to Include
assignment lecturer, unit, projects, students, iterations, pa_forms
unit lecturer, assignments, department
project assignment, unit, students
iteration
pa_form iteration
peer_assessment pa_form, submitted_by, submitted_for

Example

{
  "assignment": {
    "id": 3,
    "start_date": "2016-09-10",
    "end_date": "2017-02-01",
    "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
    "href": "/assignments/3",
    "unit": {
      "id": 1,
      "name": "Unit 193",
      "code": "OUuYh4VxV6yAcg==",
      "semester": "Spring",
      "year": 2014,
      "archived_at": null
    },
    "projects": [
      {
        "id": 1,
        "name": "Team 1",
        "logo": null,
        "enrollment_key": "2b43447611b6075b7e750c5fd7096bb0"
      },
      {
        "id": 2,
        "name": "Team 2",
        "logo": null,
        "enrollment_key": "fe55f11d0458ad599e51d5143a0b27ed"
      }
    ]
  }
}

Includes

To avoid excess trips to the server, one can optionally get any associated records together with each resource. This is accomplished by using the includes parameter e.g. /v1/assignment?includes=unit,projects. This makes the server eager load the associated record and return them in the response. Each resource has specific association that it can include, and those may vary between Student and Lecturer. Refer to the params section of each Endpoint to see the available options for both Student and Lecturer. Each resource must be separated by comma, and the correct singular or plural form of the work must be used, depending on the nature of its relationship to the endpoint resource. For example, an Assignment has many projects, so the parametera passed should be projects, not project.

Available Associations for each Resource

Resource Available Associations to Include
assignment lecturer, unit, iterations, projects
unit lecturer, department, assignments
project assignment, unit, students, lecturer
iteration pa_form
pa_form iteration
peer_assessment pa_form, submitted_by, submitted_for

Example

{
  "assignment": {
    "id": 3,
    "start_date": "2016-09-10",
    "end_date": "2017-02-01",
    "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
    "href": "/assignments/3",
    "unit": {
      "id": 1,
      "name": "Unit 193",
      "code": "OUuYh4VxV6yAcg==",
      "semester": "Spring",
      "year": 2014,
      "archived_at": null
    },
    "projects": [
      {
        "id": 1,
        "name": "Team 1",
        "logo": null,
        "enrollment_key": "2b43447611b6075b7e750c5fd7096bb0"
      },
      {
        "id": 2,
        "name": "Team 2",
        "logo": null,
        "enrollment_key": "fe55f11d0458ad599e51d5143a0b27ed"
      }
    ]
  }
}

Compact

Due to the power that the Users have by using the includes parameter, the response can grow significantly due to the number of records. To balance this, the compact parameter can be used. This indicates that the associated records should not be returned in their full form, but in a slimed down version. This usually means that the associated records will only contain their ‘id’.

Examples

{
  "assignment": {
    "id": 3,
    "start_date": "2016-09-10",
    "end_date": "2017-02-17",
    "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
    "unit": {
      "id": 1
    },
    "projects": [
      {
        "id": 1
      },
      {
        "id": 2,
        "href": "/v1/projects/2"
      }
    ]
  }
}

Assignments

‘An Assignment belongs to Unit and has many Projects’

Assignments belong to Units and have many teams of Students. A Lecturer creates a Assignment, and Students undertake a assignments by spliting themselves into teams. A Assignments can have many Iterations, for each of which the Students are expected to complete peer assessments.

Attributes

Parameter Type Description
name string The name of the Assignment.
start_date DateTime The Date that the Assignment started
end_date DateTime The Date that the Assignment ended
unit_id Integer The id of the Unit that the Assignment belongs to
lecturer_id Integer The id of the Lecturer that the Assignment belongs to

Relationships

Assignment Relationships

Create Assignment

Request

POST /assignments
{
  "end_date": "2017-09-12",
  "lecturer": "9",
  "lecturer_id": "9",
  "name": "Assignment 0",
  "start_date": "2017-05-06",
  "unit_id": "1"
}

Response

Status: 201 -- Created
{
  "assignment": {
    "id": 5,
    "start_date": "2017-05-06T00:00:00.000Z",
    "end_date": "2017-09-12T00:00:00.000Z",
    "name": "Assignment 0",
    "unit_id": 1
  }
}

Example: Creating an Assignment with 2 Projects

Request

POST /assignments
{
  "end_date": "2017-08-06",
  "lecturer": "18",
  "lecturer_id": "18",
  "name": "Assignment 0",
  "projects_attributes": [
    {
      "description": "dddd",
      "enrollment_key": "key",
      "project_name": "New Project1",
      "team_name": "persons"
    },
    {
      "description": "descr",
      "enrollment_key": "key2",
      "project_name": "New Project2",
      "team_name": "persons2"
    }
  ],
  "start_date": "2017-05-06",
  "unit_id": "7"
}

Response

Status: 201 -- Created
{
  "assignment": {
    "id": 10,
    "start_date": "2017-05-06T00:00:00.000Z",
    "end_date": "2017-08-06T00:00:00.000Z",
    "name": "Assignment 0",
    "unit_id": 7,
    "projects": [
      {
        "id": 2,
        "assignment_id": 10,
        "project_name": "New Project2",
        "team_name": "persons2",
        "description": "descr",
        "logo": null,
        "enrollment_key": "key2",
        "unit_id": 7,
        "color": null,
        "pending_project_evaluation": false,
        "points": {
          "total": 0,
          "average": 0
        }
      },
      {
        "id": 1,
        "assignment_id": 10,
        "project_name": "New Project1",
        "team_name": "persons",
        "description": "dddd",
        "logo": null,
        "enrollment_key": "key",
        "unit_id": 7,
        "color": null,
        "pending_project_evaluation": false,
        "points": {
          "total": 0,
          "average": 0
        }
      }
    ]
  }
}

Example: Creating an Assignment with Game Settings

Request

POST /assignments/1/game_settings
{
  "end_date": "2017-10-04",
  "game_setting_attributes": {
    "max_logs_per_day": "3",
    "points_log": "86",
    "points_log_first_of_day": "10",
    "points_peer_assessment": "10",
    "points_peer_assessment_first_of_team": "10",
    "points_peer_assessment_submitted_first_day": "10",
    "points_project_evaluation": "10",
    "points_project_evaluation_first_of_team": "10",
    "points_project_evaluation_submitted_first_day": "10"
  },
  "lecturer": "27",
  "lecturer_id": "27",
  "name": "Assignment 0",
  "start_date": "2017-05-06",
  "unit_id": "13"
}

Response

Status: 201 -- Created
{
  "assignment": {
    "id": 15,
    "start_date": "2017-05-06T00:00:00.000Z",
    "end_date": "2017-10-04T00:00:00.000Z",
    "name": "Assignment 0",
    "unit_id": 13
  }
}

Example: Creating an Assignment with Iterations

Request

POST /assignments/1/game_settings
{
  "end_date": "2017-08-12",
  "iterations_attributes": [
    {
      "assignment": "20",
      "deadline": "2017-08-12",
      "name": "Analysis",
      "start_date": "2017-05-06"
    },
    {
      "assignment": "21",
      "deadline": "2017-08-12",
      "name": "Design",
      "start_date": "2017-05-06"
    }
  ],
  "lecturer": "36",
  "lecturer_id": "36",
  "name": "Assignment 0",
  "start_date": "2017-05-06",
  "unit_id": "19"
}

Response

Status: 201 -- Created
{
  "assignment": {
    "id": 22,
    "start_date": "2017-05-06T00:00:00.000Z",
    "end_date": "2017-08-12T00:00:00.000Z",
    "name": "Assignment 0",
    "unit_id": 19
  }
}

Example: Errors in projects_attributes

Request (Error)

POST /assignments
{
  "end_date": "2017-10-19",
  "lecturer": "60",
  "lecturer_id": "60",
  "name": "Assignment 0",
  "projects_attributes": [
    {
      "description": "dddd",
      "enrollment_key": "key",
      "project_name": "New Project1"
    },
    {
      "description": "descr",
      "enrollment_key": "key2",
      "team_name": "persons2"
    }
  ],
  "start_date": "2017-05-06",
  "unit_id": "35"
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "projects.project_name": [
      "can't be blank"
    ]
  }
}

Create a new Assignment. Only Lecturers can create a Assignment, and it will automatically be associated with the current user. Requires a unit_id, which must be a Unit that belongs to the current user. Can also create multiple Projects through the same request. See examples.

HTTP Request

POST http://example.com/v1/assignments

Query Parameters

RequiredParameterTypeDesription
requiredunit_idIntegerThe id of the Unit that the new Assignment will belong to
requirednameStringThe name of the Assignment
requiredstart_dateDateThe date that the Assignment starts
requiredend_dateDateThe year that the Unit takes place
projects_attributes: [{ project_name, team_name, description, enrollment_key, logo}]ArrayAn array of projects parameters to create associated projects for the new Assignment. See examples.
game_setting_attributes: { points_log, points_log_first_of_day, points_log_first_of_team, points_log_first_of_assignment, points_peer_assessment, points_peer_assessment_first_of_day, points_peer_assessment_first_of_team, points_peer_assessment_first_of_assignment, points_project_evaluation, points_project_evaluation_first_of_day, points_project_evaluation_first_of_team, points_project_evaluation_first_of_assignment}ObjectAn oject containing all the parameters for the GameSetting. See Examples.

Create Projects in same request

There is the Option of creating Projects for the Assignment through this endpoint. Pass the parameters for each project in an array, with "projects_attributes" as the key

{ "name": "New Unit", "projects_attributes": [ { "project_name": "New Project1", "team_name": "persons", "description": "dddd", "enrollment_key": "key" }, { "project_name": "New Project2", "team_name": "persons2", "description": "descr", "enrollment_key": "key2" } ] }

Projects will be validated normally, and errors will be returned in the response. If no team_name is specified, it will be autogenerated and it will follow the pattern 'Team 1', 'Team 2' etc.

Create Game Settings in same request

Game settings may also be created be passing its attributes insidde "game_setting_attributes". Note the singular 'setting'.

{ "points_log": 10, "points_log_first_of_day": 10, "points_log_first_of_team": 10, "points_log_first_of_assignment": 10, "points_peer_assessment": 10, "points_peer_assessment_first_of_day": 10, "points_peer_assessment_first_of_team": 10, "points_peer_assessment_first_of_assignment": 10, "points_project_evaluation": 10, "points_project_evaluation_first_of_day": 10, "points_project_evaluation_first_of_team": 10, "points_project_evaluation_first_of_assignment": 10 }

Game Settings will be validated normally, and if any values are ommited from the parameters, the default values will automatically be set.

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- The current user is not associated with this resource
422Unprocessable Entity -- Invalid Params. See response body for more info.

Get Assignments

Request

GET /assignments

Response

Status: 200 -- OK
{
  "assignments": [
    {
      "id": 5,
      "start_date": "2017-05-06T00:00:00.000Z",
      "end_date": "2017-08-29T00:00:00.000Z",
      "name": "Assignment 0",
      "unit_id": 1,
      "pa_form": {
        "pa_form": {
          "id": 1,
          "iteration_id": 1,
          "questions": [
            {
              "text": "What do you typically have for breakfast?",
              "type_id": 1,
              "question_id": 1,
              "question_type": {
                "id": 1,
                "question_type": "text",
                "friendly_name": "name"
              }
            },
            {
              "text": "Could you ever hand milk a cow?",
              "type_id": 1,
              "question_id": 2,
              "question_type": {
                "id": 1,
                "question_type": "text",
                "friendly_name": "name"
              }
            },
            {
              "text": "Have you ever been in a helicopter?",
              "type_id": 1,
              "question_id": 3,
              "question_type": {
                "id": 1,
                "question_type": "text",
                "friendly_name": "name"
              }
            },
            {
              "text": "If you were a fashion designer, what style of clothing or accessories would you design?",
              "type_id": 1,
              "question_id": 4,
              "question_type": {
                "id": 1,
                "question_type": "text",
                "friendly_name": "name"
              }
            },
            {
              "text": "Can you play poker?",
              "type_id": 1,
              "question_id": 5,
              "question_type": {
                "id": 1,
                "question_type": "text",
                "friendly_name": "name"
              }
            }
          ],
          "start_date": "2017-08-31T03:00:00.000+03:00",
          "deadline": "2017-09-03T03:00:00.000+03:00"
        }
      }
    },
    {
      "id": 3,
      "start_date": "2017-05-06T00:00:00.000Z",
      "end_date": "2017-09-19T00:00:00.000Z",
      "name": "Assignment 0",
      "unit_id": 2
    },
    {
      "id": 2,
      "start_date": "2017-05-06T00:00:00.000Z",
      "end_date": "2017-09-04T00:00:00.000Z",
      "name": "Assignment 0",
      "unit_id": 1
    },
    {
      "id": 1,
      "start_date": "2017-05-06T00:00:00.000Z",
      "end_date": "2017-08-14T00:00:00.000Z",
      "name": "Assignment 0",
      "unit_id": 1
    }
  ]
}

Example: Get Assingments for specific Unit

Request

GET /assignments
{
  "unit_id": "1"
}

Response

Status: 200 -- OK
{
  "assignments": [
    {
      "id": 2,
      "start_date": "2017-05-06T00:00:00.000Z",
      "end_date": "2017-09-04T00:00:00.000Z",
      "name": "Assignment 0",
      "unit_id": 1
    },
    {
      "id": 1,
      "start_date": "2017-05-06T00:00:00.000Z",
      "end_date": "2017-08-14T00:00:00.000Z",
      "name": "Assignment 0",
      "unit_id": 1
    }
  ]
}

Returns all the Assignments for the current user. If a unit_id is passed in the parameters, the assignments will be scoped to that Unit.

HTTP Request

GET http://example.com/v1/assignments

Query Parameters

RequiredParameterTypeDesription
unit_idIntegerReturn all Assignments for a specific Unit

Errors

Error CodeMeaning
400Bad Request -- Invalid 'includes' parameter
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.

Get Assignments

Request

GET /assignments

Response

Status: 200 -- OK
{
  "assignments": [
    {
      "id": 5,
      "start_date": "2017-05-06T00:00:00.000Z",
      "end_date": "2017-08-29T00:00:00.000Z",
      "name": "Assignment 0",
      "unit_id": 1,
      "pa_form": {
        "pa_form": {
          "id": 1,
          "iteration_id": 1,
          "questions": [
            {
              "text": "What do you typically have for breakfast?",
              "type_id": 1,
              "question_id": 1,
              "question_type": {
                "id": 1,
                "question_type": "text",
                "friendly_name": "name"
              }
            },
            {
              "text": "Could you ever hand milk a cow?",
              "type_id": 1,
              "question_id": 2,
              "question_type": {
                "id": 1,
                "question_type": "text",
                "friendly_name": "name"
              }
            },
            {
              "text": "Have you ever been in a helicopter?",
              "type_id": 1,
              "question_id": 3,
              "question_type": {
                "id": 1,
                "question_type": "text",
                "friendly_name": "name"
              }
            },
            {
              "text": "If you were a fashion designer, what style of clothing or accessories would you design?",
              "type_id": 1,
              "question_id": 4,
              "question_type": {
                "id": 1,
                "question_type": "text",
                "friendly_name": "name"
              }
            },
            {
              "text": "Can you play poker?",
              "type_id": 1,
              "question_id": 5,
              "question_type": {
                "id": 1,
                "question_type": "text",
                "friendly_name": "name"
              }
            }
          ],
          "start_date": "2017-08-31T03:00:00.000+03:00",
          "deadline": "2017-09-03T03:00:00.000+03:00"
        }
      }
    },
    {
      "id": 3,
      "start_date": "2017-05-06T00:00:00.000Z",
      "end_date": "2017-09-19T00:00:00.000Z",
      "name": "Assignment 0",
      "unit_id": 2
    },
    {
      "id": 2,
      "start_date": "2017-05-06T00:00:00.000Z",
      "end_date": "2017-09-04T00:00:00.000Z",
      "name": "Assignment 0",
      "unit_id": 1
    },
    {
      "id": 1,
      "start_date": "2017-05-06T00:00:00.000Z",
      "end_date": "2017-08-14T00:00:00.000Z",
      "name": "Assignment 0",
      "unit_id": 1
    }
  ]
}

Returns all the Assignments for the current user

HTTP Request

GET http://example.com/v1/assignments

Errors

Error CodeMeaning
400Bad Request -- Invalid 'includes' parameter
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not associated with this resource
403Forbidden -- unit_id was present in the params. This is a lecturer-only functionality. Retry without any parameters.

Get Single Assignment

Request

GET /assignments/:id
{
  "includes": "unit",
  "id": "9"
}

Response

Status: 200 -- OK
{
  "assignment": {
    "id": 9,
    "start_date": "2017-05-06T00:00:00.000Z",
    "end_date": "2017-10-13T00:00:00.000Z",
    "name": "Assignment 0",
    "unit_id": 9,
    "unit": {
      "id": 9,
      "name": "Unit 959",
      "code": "uC5yGKbI1Letcw==",
      "semester": "Autumn",
      "year": 2015,
      "archived_at": null,
      "department_id": 9
    }
  }
}

Returns a single Assignment

HTTP Request

GET http://example.com/v1/assignments/:id

Errors

Error CodeMeaning
400Bad Request -- Invalid 'includes' parameter
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not associated with this resource

Update Assignment

Request

PATCH /assignments/:id
{
  "name": "new name",
  "id": "34"
}

Response

Status: 200 -- OK
{
  "assignment": {
    "id": 34,
    "start_date": "2017-05-06T00:00:00.000Z",
    "end_date": "2017-08-13T00:00:00.000Z",
    "name": "new name",
    "unit_id": 42
  }
}

Update an Assignment. Only Lecturers can create a Assignment, and it will automatically be associated with the current user. Requires a unit_id, which must be a Unit that belongs to the current user. Can also create multiple Projects through the same request. See examples.

HTTP Request

PATCH http://example.com/v1/assignments/:id

Query Parameters

RequiredParameterTypeDesription
requiredunit_idIntegerThe id of the Unit that the new Assignment will belong to
nameStringThe name of the Assignment
start_dateDateThe date that the Assignment starts
end_dateDateThe year that the Unit takes place
projects_attributes: [{ project_name, team_name, description, enrollment_key, logo}]ArrayAn array of projects parameters to create associated projects for the new Assignment. See examples.

There is the Option of creating Projects for the Assignment through this endpoint. Pass the parameters for each project in an array, with "projects_attributes" as the key

{ "name": "New Unit", "projects_attributes": [ { "project_name": "New Project1", "team_name": "persons", "description": "dddd", "enrollment_key": "key" }, { "project_name": "New Project2", "team_name": "persons2", "description": "descr", "enrollment_key": "key2" } ] }

Projects will be validated normally, and errors will be returned in the response.

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- The current user is not associated with this resource
422Unprocessable Entity -- Invalid Params. See response body for more info.

Delete Assignment

Delete an Assignment. Only the Lecturer that created it may do so.

HTTP Request

DELETE http://example.com/v1/assignments/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Assignment to be deleted.

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- The current user is not associated with this resource
422Unprocessable Entity -- Invalid Params. See response body for more info.

Authentication

‘Register, Sign In, Sign Out’

Authentication is implemented using JWT (JSON Web Tokens).

After successful authentication, a user is issued two JWT tokens which are stored in secure, http-only cookies. Both tokens have an expiration date. The first token, the access-token is used to authenticate the user on following requests. The second token, the refresh-token is only sent to the /refresh path and is used to issue the user a new access-token.

To prevent CSRF Attacks, the access-token contains a csrf-token value, which is equal to the XSRF-TOKEN header that the response contains upon successful authentication. The client must send the token contained in the params on each request that requires authentication, is a header called X-XSRF-TOKEN. The X-XSRF-TOKEN header and the csrf-token value in the access-token are compared by the server.

Sign In

Request

POST /sign_in
{
  "email": "alfredo66640_jump47088@gmail.com",
  "password": "12345678"
}

Response

Status: 200 -- OK
{
  "user": {
    "id": 2,
    "first_name": "Alfredo344",
    "last_name": "Jumpveryhigh45",
    "email": "alfredo66640_jump47088@gmail.com",
    "type": "Lecturer",
    "provider": "email",
    "avatar_url": "http://i.pravatar.cc/100",
    "position": "Master of Parking",
    "university": "University of Important Potato"
  }
}

Request (Error)

POST /sign_in
{
  "email": "alfredo88898_jump8272@gmail.com",
  "password": "wrongpassword"
}

Response

Status: 401 -- Unauthorized
{
  "errors": {
    "base": [
      "Invalid Login Credentials"
    ]
  }
}

Request (Error)

POST /sign_in
{
  "email": "alfredo63302_jump90718@gmail.com",
  "password": "12345678",
  "remember_me": "true"
}

Response

Status: 401 -- Unauthorized
{
  "errors": {
    "base": [
      "remember_me must be either '0' or '1'. Received value: true"
    ],
    "email": [
      "is unconfirmed"
    ]
  }
}

Request (Error)

POST /sign_in
{
  "email": "alfredo91707_jump8968@gmail.com",
  "password": "12345678"
}

Response

Status: 401 -- Unauthorized
{
  "errors": {
    "email": [
      "is unconfirmed"
    ]
  }
}

Sign In using Email and Password. The user must have confirmed their account through the confirmation email sent after /register. On successful authentication, the user is returned. The XSRF-TOKEN header is added to the response, which should be saved on the client, to be added in subsequent requests under the header X-XSRF-TOKEN. The response also sets two cookies, one with the access-token, and one with the refresh-token, which are secure and http-only, thus they are not accessible via javascript, and require no further action for the client in order to use them. The access-token cookie will automatically be sent to all subsequent requests, while the refresh-token cookie will only be sent to the /refresh path. The remember_me param should be either '0' for false, or '1' for true.

HTTP Request

POST http://example.com/v1/sign_in

Query Parameters

RequiredParameterTypeDesription
requiredemailStringThe User's Email
requiredpasswordStringThe User's password
requiredremember_meIntegerWhether the userp will stay logged in after the browser closes. Accepted Values: '0' for false, '1' for true. Defaults to false.

Errors

Error CodeMeaning
401Unauthorized -- Missing email/password, wrong email/password, invalid value for remember_me or unconfirmed account. see errors in response body.

Sign In

Request

POST /sign_in
{
  "email": "alfredo66640_jump47088@gmail.com",
  "password": "12345678"
}

Response

Status: 200 -- OK
{
  "user": {
    "id": 2,
    "first_name": "Alfredo344",
    "last_name": "Jumpveryhigh45",
    "email": "alfredo66640_jump47088@gmail.com",
    "type": "Lecturer",
    "provider": "email",
    "avatar_url": "http://i.pravatar.cc/100",
    "position": "Master of Parking",
    "university": "University of Important Potato"
  }
}

Request (Error)

POST /sign_in
{
  "email": "alfredo88898_jump8272@gmail.com",
  "password": "wrongpassword"
}

Response

Status: 401 -- Unauthorized
{
  "errors": {
    "base": [
      "Invalid Login Credentials"
    ]
  }
}

Request (Error)

POST /sign_in
{
  "email": "alfredo63302_jump90718@gmail.com",
  "password": "12345678",
  "remember_me": "true"
}

Response

Status: 401 -- Unauthorized
{
  "errors": {
    "base": [
      "remember_me must be either '0' or '1'. Received value: true"
    ],
    "email": [
      "is unconfirmed"
    ]
  }
}

Request (Error)

POST /sign_in
{
  "email": "alfredo91707_jump8968@gmail.com",
  "password": "12345678"
}

Response

Status: 401 -- Unauthorized
{
  "errors": {
    "email": [
      "is unconfirmed"
    ]
  }
}

Sign In using Email and Password. The user must have confirmed their account through the confirmation email sent after /register. On successful authentication, the user is returned. The XSRF-TOKEN header is added to the response, which should be saved on the client, to be added in subsequent requests under the header X-XSRF-TOKEN. The response also sets two cookies, one with the access-token, and one with the refresh-token, which are secure and http-only, thus they are not accessible via javascript, and require no further action for the client in order to use them. The access-token cookie will automatically be sent to all subsequent requests, while the refresh-token cookie will only be sent to the /refresh path. The remember_me param should be either '0' for false, or '1' for true.

HTTP Request

POST http://example.com/v1/sign_in

Query Parameters

RequiredParameterTypeDesription
requiredemailStringThe User's Email
requiredpasswordStringThe User's password
requiredremember_meIntegerWhether the userp will stay logged in after the browser closes. Accepted Values: '0' for false, '1' for true. Defaults to false.

Errors

Error CodeMeaning
401Unauthorized -- Missing email/password, wrong email/password, invalid value for remember_me or unconfirmed account. see errors in response body.

Me

Request

GET /me

Response

Status: 200 -- OK
{
  "user": {
    "id": 5,
    "first_name": "Alfredo227",
    "last_name": "Jumpveryhigh235",
    "email": "alfredo32353_jump75759@gmail.com",
    "type": "Lecturer",
    "provider": "email",
    "avatar_url": "http://i.pravatar.cc/100",
    "position": "Master of Parking",
    "university": "University of Important Potato"
  }
}

Authenticate with the server after exiting the application. Returns the current_user in the response body. Due to the short expiration time of the access-token, requests to this endpoint will most likely be successful for a short period of time. If the request is not successful, the application should send a request to the /refresh route, in order to receive a new access-token.

HTTP Request

GET http://example.com/v1/me

Errors

Error CodeMeaning
401Unauthorized -- User Authentication failed. Either the X-XSRF-TOKEN is missing from the headers, or the access-token is missing, invalid or expired

Me

Request

GET /me

Response

Status: 200 -- OK
{
  "user": {
    "id": 5,
    "first_name": "Alfredo227",
    "last_name": "Jumpveryhigh235",
    "email": "alfredo32353_jump75759@gmail.com",
    "type": "Lecturer",
    "provider": "email",
    "avatar_url": "http://i.pravatar.cc/100",
    "position": "Master of Parking",
    "university": "University of Important Potato"
  }
}

Authenticate with the server after exiting the application. Returns the current_user in the response body. Due to the short expiration time of the access-token, requests to this endpoint will most likely be successful for a short period of time. If the request is not successful, the application should send a request to the /refresh route, in order to receive a new access-token.

HTTP Request

GET http://example.com/v1/me

Errors

Error CodeMeaning
401Unauthorized -- User Authentication failed. Either the X-XSRF-TOKEN is missing from the headers, or the access-token is missing, invalid or expired

Refresh

Refresh the access-token of the user. Requires a refresh-token stored in a cookie. On successful validation of the refresh-token, the response sets two new access-token and refresh-token cookies, and contains a new XSRF-TOKEN header, to be saved by the client.

HTTP Request

POST http://example.com/v1/refresh

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed

Sign Out

Request

POST /sign_out

Response

Status: 204 -- No Content
{
  ""
}

Sign out of the application. One has to be authenticated in order to sign out, meaning that the requrest has to have an access-token cookie, and an X-XSRF-TOKEN header. On successful authentication, the user's refresh-token is deleted from the database, as well as the access-token and refresh-token cookies.

HTTP Request

POST http://example.com/v1/sign_out

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed

Reset Password

To reset your password, first do a POST to /request_reset_password. This will cause an email to be sent to your email. Follow the link in that email, which will lead you to the reset your password page. After completing the form, the form should be submitted to PATCH /reset_password, along with the reset_password_token that was in the link that brought the user to the page.

Reset Password - Send Reset Email

Request

POST /request_reset_password
{
  "email": "alfredo14088_jump87490@gmail.com"
}

Response

Status: 204 -- No Content
{
  ""
}

Request (Error)

POST /request_reset_password

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "email": [
      "is invalid"
    ]
  }
}

Send a reset password email to the given email. The email will only be sent if it matches a user in the system. The sent email will contain a url for the user to visit, with a reset_password token.

HTTP Request

POST http://example.com/v1/request_reset_password

Query Parameters

RequiredParameterTypeDesription
requiredemailStringThe user's email that will be used to send the reset password email

Errors

Error CodeMeaning
403Forbidden -- User was found, however they did not register with email/password, thus they have no password to reset.
422Unprocessable Entity -- Email is invalid, or email failed to be sent

Reset Password - Change Password

Request

PATCH /request_reset_password
{
  "password": "password1",
  "password_confirmation": "password1",
  "reset_password_token": "zGGizwfHy2dsGy37dy-N"
}

Response

Status: 204 -- No Content
{
  ""
}

Request (Error)

PATCH /request_reset_password
{
  "password": "abcdefgh",
  "password_confirmation": "abcdefgh"
}

Response

Status: 400 -- Bad Request
{
  "errors": {
    "reset_password_token": [
      "can't be blank"
    ]
  }
}

Request (Error)

PATCH /request_reset_password
{
  "password": "abcdefgh",
  "password_confirmation": "abcdefgh",
  "reset_password_token": "randomsdfalkjfdljfsadljfdsaklfdsalk"
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "reset_password_token": [
      "is invalid"
    ]
  }
}

To successfully reset a user's password, the user's reset_password_token needs to be present in the params. To get that, the client must extract it from the params of the request that brought the user to the 'reset your password form'.

HTTP Request

PATCH http://example.com/v1/reset_password

Query Parameters

RequiredParameterTypeDesription
requiredreset_password_tokenStringPart of the url that brought the user to the 'reset your password page'
requiredpasswordStringThe new Password
requiredpassword_confirmationStringMust be equal to the password

Errors

Error CodeMeaning
400Bad Request -- The request is missing the reset_password_token param
422Unprocessable Entity -- password_reset_token, password or password_confirmation is invalid

Departments

‘Departments contain Units’

A Department has a name and a university attribute. A Unit belongs to a Department.

Attributes

Parameter Type Description
name string The name of the Department.
university string The University that the Department belongs to

Relationships

Department Relationships

Update Department

Update Department

HTTP Request

PATCH http://example.com/v1/departments/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Department to be updated
namestringThe name of the Department
universitystringThe name of the Department's university

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
422Unprocessable Entity -- Invalid Params. See response body for more info.

Delete Department

Delete Department

HTTP Request

DELETE http://example.com/v1/departments/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Department to be deleted

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
422Unprocessable Entity -- Invalid Params. See response body for more info.

Feelings

Feelings are part of project evaluation. In each evaluation, the user has to the set the percentage that each of the available feelings represent their feelings about the project. Each feeling also has a value associated with it. Currently, feelings can have either values of either -1 (a negative feeling), and a 1 (a positive feeling). However, the value field accepts any integer, and it is possible to define different values for each feeling, allowing them to be processed in more complicated ways.

Attributes

Parameter Type Description
id Integer The id of the Feeling that will be used when creating a new Project Evaluation
name String The name of the Feeling
value Integer The value associated with the feeling. It is either -1 (for negative) or 1 (for positive feelings).

Get Available Feelings

Request

GET /feelings

Response

Status: 200 -- OK
{
  "feelings": [
    {
      "id": 1,
      "name": "Happy"
    },
    {
      "id": 2,
      "name": "Sad"
    }
  ]
}

Returns all available Feelings to use when creating the Project Evaluation Form

HTTP Request

GET http://example.com/v1/feelings

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed

Form Templates

‘Saved Peer Assessment Forms for the Lecturer’

A FormTemplate contains a collection of questions that can be used by the Lecturer to create a new PaForm. Form Templates are created independently of the the PaForms, and can be selected in the PaForm creation process. Each Lecturer has their own collection of FormTemplates, and each one is identified by a name, specified by the Lecturer.

Attributes

Parameter Type Description
name String The name that identifies the FormTemplate
lecturer_id Integer The id of the Lecturer that created the FormTemplate
questions JSON The questions of the form. See “Questions Format” below for explanation

Questions Format

Questions are submitted and saved as a JSON array of JSON objects that contain the 'question_id’, the 'text’ of the question, and its 'type_id’, which corresponds to the id of one of the available QuestionTypes. Questions should be submitted in the following format:

questions: [ { text: 'Question?', type_id: 2 } ]

Example

{
  "questions": [
    {
      "text": "Did this person work hard?",
      "type_id": 2
    },
    {
      "text": "Did they deliver the work in time?",
      "type_id": 1
    },
    {
      "text": "Die they exhbit leadership skills?",
      "type_id": 2
    }
  ]
}

The questions format will be validated, and input will be rejected if it does not follow the above example.

Get Form Templates

Request

GET /form_templates

Response

Status: 200 -- OK
{
  "form_templates": [
    {
      "id": 1,
      "name": "Sublimely Self-Righteous Ale Template",
      "lecturer_id": 1,
      "questions": [
        {
          "text": "At what age did you twig onto the fact Santa wasnt real?",
          "type_id": 1,
          "question_id": 1,
          "question_type": {
            "id": 1,
            "question_type": "text",
            "friendly_name": "name"
          }
        },
        {
          "text": "What horror fiction character scares you the most?",
          "type_id": 1,
          "question_id": 2,
          "question_type": {
            "id": 1,
            "question_type": "text",
            "friendly_name": "name"
          }
        },
        {
          "text": "If you were to join an emergency service which would it be?",
          "type_id": 1,
          "question_id": 3,
          "question_type": {
            "id": 1,
            "question_type": "text",
            "friendly_name": "name"
          }
        },
        {
          "text": "Could you ever hand milk a cow?",
          "type_id": 1,
          "question_id": 4,
          "question_type": {
            "id": 1,
            "question_type": "text",
            "friendly_name": "name"
          }
        },
        {
          "text": "What historical period would you like to live in if you could go back in time?",
          "type_id": 1,
          "question_id": 5,
          "question_type": {
            "id": 1,
            "question_type": "text",
            "friendly_name": "name"
          }
        }
      ]
    },
    {
      "id": 2,
      "name": "La Fin Du Monde Template",
      "lecturer_id": 1,
      "questions": [
        {
          "text": "What do you think the greatest invention has been?",
          "type_id": 1,
          "question_id": 1,
          "question_type": {
            "id": 1,
            "question_type": "text",
            "friendly_name": "name"
          }
        },
        {
          "text": "If you were a fashion designer, what style of clothing or accessories would you design?",
          "type_id": 1,
          "question_id": 2,
          "question_type": {
            "id": 1,
            "question_type": "text",
            "friendly_name": "name"
          }
        },
        {
          "text": "Could you ever hand milk a cow?",
          "type_id": 1,
          "question_id": 3,
          "question_type": {
            "id": 1,
            "question_type": "text",
            "friendly_name": "name"
          }
        },
        {
          "text": "Can you solve sudoko puzzles?",
          "type_id": 1,
          "question_id": 4,
          "question_type": {
            "id": 1,
            "question_type": "text",
            "friendly_name": "name"
          }
        },
        {
          "text": "If you were to join an emergency service which would it be?",
          "type_id": 1,
          "question_id": 5,
          "question_type": {
            "id": 1,
            "question_type": "text",
            "friendly_name": "name"
          }
        }
      ]
    }
  ]
}

Returns all the Form Templates associated with the current user.

HTTP Request

GET http://example.com/v1/form_templates

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.

Create Form Template

Request

POST /form_templates
{
  "name": "new name",
  "questions": [
    {
      "text": "If you were to join an emergency service which would it be?",
      "type_id": "5"
    },
    {
      "text": "Have you ever been approached by someone who knew you but you couldn't remember them for the life of you?",
      "type_id": "5"
    },
    {
      "text": "Do you prefer Honey or Jam?",
      "type_id": "5"
    },
    {
      "text": "What do you think the greatest invention has been?",
      "type_id": "5"
    },
    {
      "text": "What do you typically have for breakfast?",
      "type_id": "5"
    }
  ]
}

Response

Status: 201 -- Created
{
  "form_template": {
    "id": 6,
    "name": "new name",
    "lecturer_id": 8,
    "questions": [
      {
        "question_id": 1,
        "text": "If you were to join an emergency service which would it be?",
        "type_id": "5"
      },
      {
        "question_id": 2,
        "text": "Have you ever been approached by someone who knew you but you couldn't remember them for the life of you?",
        "type_id": "5"
      },
      {
        "question_id": 3,
        "text": "Do you prefer Honey or Jam?",
        "type_id": "5"
      },
      {
        "question_id": 4,
        "text": "What do you think the greatest invention has been?",
        "type_id": "5"
      },
      {
        "question_id": 5,
        "text": "What do you typically have for breakfast?",
        "type_id": "5"
      }
    ]
  }
}

Create a new Form Template. The lecturer_id is automatically set to the current user's id.

HTTP Request

POST http://example.com/v1/form_templates

Query Parameters

RequiredParameterTypeDesription
requirednameStringThe name that identifies the FormTemplate
requiredquestionsJSONThe questions of the form. See 'Questions Format' section for information about the format

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
422Unprocessable Entity -- Invalid params. Start Date must be sometime AFTER the current time, and deadline must be AFTER start_date. See response body.

Update Form Template

Request

PATCH /form_templates/:id
{
  "name": "new name",
  "questions": [
    {
      "text": "Can you solve sudoko puzzles?",
      "type_id": "2"
    },
    {
      "text": "Have you ever been approached by someone who knew you but you couldn't remember them for the life of you?",
      "type_id": "2"
    },
    {
      "text": "What historical period would you like to live in if you could go back in time?",
      "type_id": "2"
    },
    {
      "text": "Whats your favourite alcoholic drink beginning with the letter V?",
      "type_id": "2"
    },
    {
      "text": "What are cooler? Dinosaurs or Dragons?",
      "type_id": "2"
    }
  ],
  "id": "3"
}

Response

Status: 200 -- OK
{
  "form_template": {
    "id": 3,
    "name": "new name",
    "lecturer_id": 4,
    "questions": [
      {
        "question_id": 1,
        "text": "Can you solve sudoko puzzles?",
        "type_id": "2"
      },
      {
        "question_id": 2,
        "text": "Have you ever been approached by someone who knew you but you couldn't remember them for the life of you?",
        "type_id": "2"
      },
      {
        "question_id": 3,
        "text": "What historical period would you like to live in if you could go back in time?",
        "type_id": "2"
      },
      {
        "question_id": 4,
        "text": "Whats your favourite alcoholic drink beginning with the letter V?",
        "type_id": "2"
      },
      {
        "question_id": 5,
        "text": "What are cooler? Dinosaurs or Dragons?",
        "type_id": "2"
      }
    ]
  }
}

Update a Form Template.

HTTP Request

PATCH http://example.com/v1/form_templates/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Form Template that will be updated.
nameStringThe name of the Form Template that will be updated.
requiredquestionsJSONThe questions of the form. See 'Questions Format' section for information about the format

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- The current user is not associated with this resource
422Unprocessable Entity -- Invalid Params. See response body for more info.

Delete Form Template

Request

PATCH /form_templates/:id
{
  "id": "7"
}

Response

Status: 204 -- No Content
{
  ""
}

Delete a Form Template. It must belong to the current user.

HTTP Request

DELETE http://example.com/v1/assignments/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Form Template to be deleted.

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- The current user is not associated with this resource

Game Settings

‘Settings for the points of the game’

An Assignment contains one GameSetting relation with lecturer-created settings abou the game. The lecturer descides the amount of points that the students earn for various actions. These settings apply to all Projects under the same Assignment. There are default values set by the system, which can be customized or freely by the Lecturer.

Attributes

Parameter Type Description
points_log integer Points earned for submitting a log.
points_log_first_of_day integer Points earned for submitting the first log of the day.
points_log_first_of_team integer Points earned for submitting a log before the rest of the team.
points_log_first_of_assignment integer Points earned for submitting a log before every other student in the all the Projects of the Assignment
points_peer_assessment integer Points earned for submitting a Peer Assessment
points_peer_assessment_first_of_team integer Points earned for submitting the Peer Assessment before everyone on the team.
points_peer_assessment_first_of_assignment integer Points earned for submitting the Peer Assessment before every other student in all the Projects of the Assignment
points_project_evaluation integer Points earned for submitting a Project Evaluation
points_project_evaluation_first_of_team integer Points earned for submitting a Project Evaluation before the rest of the Team.
points_project_evaluation_first_of_assignment integer Points earned for submitting a Project Evaluation before every other student in the all the Projects of the Assignment
max_logs_per_day integer The maximum number of logs that a student will get points for submitting in a day. For each log submitted the student receives less points, and after reaching this limit they stop receiving points for that day. It gets reset every 24 hours.

Get Game Setting

Request

GET /assignments/1/game_settings
{
  "assignment_id": "1"
}

Response

Status: 200 -- OK
{
  "game_settings": {
    "id": 1,
    "assignment_id": 1,
    "points_log": 10,
    "points_log_first_of_day": 10,
    "points_peer_assessment": 10,
    "points_peer_assessment_first_of_team": 10,
    "points_project_evaluation": 10,
    "points_project_evaluation_first_of_team": 10,
    "points_project_evaluation_submitted_first_day": 10,
    "points_peer_assessment_submitted_first_day": 10,
    "max_logs_per_day": 3
  }
}

Update the values of the project settings for an Assignment

HTTP Request

GET http://example.com/v1/assignments/:assignment_id/game_settings

Query Parameters

RequiredParameterTypeDesription
requiredassignment_idIntegerThe id of the Assignment that the settings belong to

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not associated with this resource
403Forbidden -- The Assignment does not exist in the database
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
422Unprocessable Entity -- Invalid Params. See response body for more info.

Create Game Setting

Request

POST /assignments/4/game_settings
{
  "assignment_id": "4"
}

Response

Status: 201 -- Created
{
  "game_settings": {
    "id": 2,
    "assignment_id": 4,
    "points_log": 50,
    "points_log_first_of_day": 0,
    "points_peer_assessment": 50,
    "points_peer_assessment_first_of_team": 5,
    "points_project_evaluation": 50,
    "points_project_evaluation_first_of_team": 5,
    "points_project_evaluation_submitted_first_day": 20,
    "points_peer_assessment_submitted_first_day": 20,
    "max_logs_per_day": 3
  }
}

Request

POST /assignments/5/game_settings
{
  "max_logs_per_day": "3",
  "points_log": "10",
  "points_log_first_of_day": "10",
  "points_peer_assessment": "10",
  "points_peer_assessment_first_of_team": "10",
  "points_peer_assessment_submitted_first_day": "10",
  "points_project_evaluation": "10",
  "points_project_evaluation_first_of_team": "10",
  "points_project_evaluation_submitted_first_day": "10",
  "assignment_id": "5"
}

Response

Status: 201 -- Created
{
  "game_settings": {
    "id": 3,
    "assignment_id": 5,
    "points_log": 10,
    "points_log_first_of_day": 10,
    "points_peer_assessment": 10,
    "points_peer_assessment_first_of_team": 10,
    "points_project_evaluation": 10,
    "points_project_evaluation_first_of_team": 10,
    "points_project_evaluation_submitted_first_day": 10,
    "points_peer_assessment_submitted_first_day": 10,
    "max_logs_per_day": 3
  }
}

Example: Error: Parameter is not a number

Request (Error)

POST /assignments/6/game_settings
{
  "max_logs_per_day": "3",
  "points_log": "wrong",
  "points_log_first_of_day": "10",
  "points_peer_assessment": "10",
  "points_peer_assessment_first_of_team": "10",
  "points_peer_assessment_submitted_first_day": "10",
  "points_project_evaluation": "10",
  "points_project_evaluation_first_of_team": "10",
  "points_project_evaluation_submitted_first_day": "10",
  "assignment_id": "6"
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "points_log": [
      "is not a number"
    ]
  }
}

Creates a new Game Setting for an Assignment. Parameters that are not provided will be replaced with the default values.

HTTP Request

POST http://example.com/v1/assignments/:assignment_id/game_settings

Query Parameters

RequiredParameterTypeDesription
requiredassignment_idIntegerThe id of the Assignment that the settings belong to
points_logintegerPoints earned for submitting a log.
points_log_first_of_dayintegerPoints earned for submitting the first log of the day.
points_log_first_of_teamintegerPoints earned for submitting a log before the rest of the team.
points_log_first_of_assignmentintegerPoints earned for submitting a log before every other student in the all the Projects of the Assignment
points_peer_assessmentintegerPoints earned for submitting a Peer Assessment
points_peer_assessment_first_of_teamintegerPoints earned for submitting the Peer Assessment before everyone on the team.
points_peer_assessment_first_of_assignmentintegerPoints earned for submitting the Peer Assessment before every other student in all the Projects of the Assignment
points_project_evaluationintegerPoints earned for submitting a Project Evaluation
points_project_evaluation_first_of_teamintegerPoints earned for submitting a Project Evaluation before the rest of the Team.
points_project_evaluation_first_of_assignmentintegerPoints earned for submitting a Project Evaluation before every other student in the all the Projects of the Assignment
max_logs_per_dayintegerThe maximum number of logs that a student is allowed to submit in one day. Defaults to 3.

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- The current user is not associated with this resource
403Forbidden -- The Assignment already has GameSetting. Try 'Update Game Setting'.
422Unprocessable Entity -- One of the points is not an integer.

Update Game Setting

Request

PATCH /assignments/1/game_settings
{
  "max_logs_per_day": "3",
  "points_log": "90",
  "points_log_first_of_day": "10",
  "points_peer_assessment": "10",
  "points_peer_assessment_first_of_team": "10",
  "points_peer_assessment_submitted_first_day": "10",
  "points_project_evaluation": "10",
  "points_project_evaluation_first_of_team": "10",
  "points_project_evaluation_submitted_first_day": "10",
  "assignment_id": "1"
}

Response

Status: 200 -- OK
{
  "game_settings": {
    "id": 1,
    "assignment_id": 1,
    "points_log": 90,
    "points_log_first_of_day": 10,
    "points_peer_assessment": 10,
    "points_peer_assessment_first_of_team": 10,
    "points_project_evaluation": 10,
    "points_project_evaluation_first_of_team": 10,
    "points_project_evaluation_submitted_first_day": 10,
    "points_peer_assessment_submitted_first_day": 10,
    "max_logs_per_day": 3
  }
}

Update the values of the project settings for an Assignment

HTTP Request

PATCH http://example.com/v1/assignments/:assignment_id/game_settings

Query Parameters

RequiredParameterTypeDesription
requiredassignment_idIntegerThe id of the Assignment that the settings belong to
points_logintegerPoints earned for submitting a log.
points_log_first_of_dayintegerPoints earned for submitting the first log of the day.
points_log_first_of_teamintegerPoints earned for submitting a log before the rest of the team.
points_log_first_of_assignmentintegerPoints earned for submitting a log before every other student in the all the Projects of the Assignment
points_peer_assessmentintegerPoints earned for submitting a Peer Assessment
points_peer_assessment_first_of_teamintegerPoints earned for submitting the Peer Assessment before everyone on the team.
points_peer_assessment_first_of_assignmentintegerPoints earned for submitting the Peer Assessment before every other student in all the Projects of the Assignment
points_project_evaluationintegerPoints earned for submitting a Project Evaluation
points_project_evaluation_first_of_teamintegerPoints earned for submitting a Project Evaluation before the rest of the Team.
points_project_evaluation_first_of_assignmentintegerPoints earned for submitting a Project Evaluation before every other student in the all the Projects of the Assignment
max_logs_per_dayintegerThe maximum number of logs that a student is allowed to submit in one day. Defaults to 3.

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- The current user is not associated with this resource
422Unprocessable Entity -- This assignment does not have game settings. First create them at POST /assignments/:assignment_id/game_settings
422Unprocessable Entity -- One of the points is not an integer.
422Unprocessable Entity -- Invalid Params. See response body for more info.

Iterations

‘An Assignment may have one or more Iterations’

Each Assignment can have many iterations which are connected with a form. A Lecturer creates Iterations for an Assignment, and Studens must submit peer evaluation forms for each Iteration. Each Iteration has its own PAForm and Project Evaluations.

Attributes

Parameter Type Description
name string The name of the Unit.
start_date Date The date that the Iteration starts. It cannot be before the start_date of the Assignment.
deadline Date The date that the Iteration ends, and the deadline for submitting the PAForm and Project Evaluations. It cannot be after the end_date of the Assignment.
assignment_id Integer The id of the Iteration that the Iteration belongs to

Relationships

Iteration Relationships

Get Assignment Iterations

Request

GET /iterations
{
  "assignment_id": "2"
}

Response

Status: 200 -- OK
{
  "iterations": [
    {
      "id": 2,
      "name": "Implementation",
      "start_date": "2017-05-06T00:00:00.000Z",
      "deadline": "2017-11-11T00:00:00.000Z",
      "assignment_id": 2
    },
    {
      "id": 3,
      "name": "Testing",
      "start_date": "2017-05-06T00:00:00.000Z",
      "deadline": "2017-11-11T00:00:00.000Z",
      "assignment_id": 2
    }
  ]
}

Returns all Iterations for a specific Assignment. Needs assignment_id in the params.

HTTP Request

GET http://example.com/v1/iterations

Query Parameters

RequiredParameterTypeDesription
requiredassignment_idIntegerThe Assignment for which the Iteration will be returned

Errors

Error CodeMeaning
400Bad Request -- assignment_id is missing from the params
401Unauthorized -- Authentication Failed

Get Assignment Iterations

Request

GET /iterations
{
  "assignment_id": "2"
}

Response

Status: 200 -- OK
{
  "iterations": [
    {
      "id": 2,
      "name": "Implementation",
      "start_date": "2017-05-06T00:00:00.000Z",
      "deadline": "2017-11-11T00:00:00.000Z",
      "assignment_id": 2
    },
    {
      "id": 3,
      "name": "Testing",
      "start_date": "2017-05-06T00:00:00.000Z",
      "deadline": "2017-11-11T00:00:00.000Z",
      "assignment_id": 2
    }
  ]
}

Returns all Iterations for a specific Assignment. Needs assignment_id in the params.

HTTP Request

GET http://example.com/v1/iterations

Query Parameters

RequiredParameterTypeDesription
requiredassignment_idIntegerThe Assignment for which the Iteration will be returned

Errors

Error CodeMeaning
400Bad Request -- assignment_id is missing from the params
401Unauthorized -- Authentication Failed

Get Specific Iteration

Request

GET /iterations/2
{
  "id": "2"
}

Response

Status: 200 -- OK
{
  "iteration": {
    "id": 2,
    "name": "Implementation",
    "start_date": "2017-05-06T00:00:00.000Z",
    "deadline": "2017-11-11T00:00:00.000Z",
    "assignment_id": 2
  }
}

Returns a specific iteration

HTTP Request

GET http://example.com/v1/iterations/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Iteration that will be returned

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not associated with this resource

Get Specific Iteration

Request

GET /iterations/2
{
  "id": "2"
}

Response

Status: 200 -- OK
{
  "iteration": {
    "id": 2,
    "name": "Implementation",
    "start_date": "2017-05-06T00:00:00.000Z",
    "deadline": "2017-11-11T00:00:00.000Z",
    "assignment_id": 2
  }
}

Returns a specific iteration

HTTP Request

GET http://example.com/v1/iterations/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Iteration that will be returned

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not associated with this resource

Create Iteration for Assignment

Request

POST /iterations
{
  "assignment_id": "1",
  "deadline": "2017-08-06T01:42:15+03:00",
  "name": "name",
  "start_date": "2017-05-13T01:42:15+03:00"
}

Response

Status: 201 -- Created
{
  "iteration": {
    "id": 4,
    "name": "name",
    "start_date": "2017-05-12T22:42:15.000Z",
    "deadline": "2017-08-05T22:42:15.000Z",
    "assignment_id": 1
  }
}

Example: Create Iteration with PaForm

Request

POST /iterations
{
  "assignment_id": "1",
  "deadline": "2017-08-06T01:42:15+03:00",
  "name": "name",
  "pa_form_attributes": {
    "end_offset": "432000",
    "questions": [
      {
        "text": "At what age did you twig onto the fact Santa wasnt real?",
        "type_id": "3"
      },
      {
        "text": "Can you play poker?",
        "type_id": "3"
      },
      {
        "text": "What are cooler? Dinosaurs or Dragons?",
        "type_id": "3"
      },
      {
        "text": "If you had friends round what DVDs would you have to watch?",
        "type_id": "3"
      },
      {
        "text": "Whats your favourite alcoholic drink beginning with the letter V?",
        "type_id": "3"
      }
    ],
    "start_offset": "172800"
  },
  "start_date": "2017-05-13T01:42:15+03:00"
}

Response

Status: 201 -- Created
{
  "iteration": {
    "id": 5,
    "name": "name",
    "start_date": "2017-05-12T22:42:15.000Z",
    "deadline": "2017-08-05T22:42:15.000Z",
    "assignment_id": 1
  }
}

Create a new Iteration for an Assignment. This endpoint can also receive attributes and create the PaForm of the Iteration. The Iteration duration must fall between the start_date and end_date of the associated Assignment.

HTTP Request

POST http://example.com/v1/iterations

Query Parameters

RequiredParameterTypeDesription
requiredassignment_idIntegerThe assignment that the iteration belongs to
requirednameStringThe name of the project
requiredstart_dateStringThe date that the Iteration starts
requireddeadlineStringThe date that the iteration ends

pa_form_attributes

Query Parameters

RequiredParameterTypeDesription
requirediteration_idIntegerThe id of the Iteration that the PA Form belongs to
requiredstart_dateDateTimeThe date from which the form is available to the Students for completion.
requireddeadlineDateTimeThe deadline after which the form will not be able to be completed by the Students. In Unix Time.
requiredquestionsJSONThe questions of the form. See 'Questions Format' section for information about the format

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- The current user is not associated with this resource
422Unprocessable Entity -- Invalid params. Start Date must be sometime AFTER the start_date of the Assignment, and deadline must be BEFORE end_date of the Assignment. See response body.

Update Iteration

Request

PATCH /projects/2
{
  "name": "different",
  "id": "2"
}

Response

Status: 200 -- OK
{
  "iteration": {
    "id": 2,
    "name": "different",
    "start_date": "2017-05-06T00:00:00.000Z",
    "deadline": "2017-11-11T00:00:00.000Z",
    "assignment_id": 2
  }
}

Update Iteration

HTTP Request

PATCH http://example.com/v1/iterations/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Iteration to be updated
nameStringThe name of the project
start_dateStringThe date that the Iteration starts
deadlineStringThe date that the iteration ends

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- The current user is not associated with this resource
422Unprocessable Entity -- Invalid params. Start Date must be sometime AFTER the current time, and deadline must be AFTER start_date. See response body.

Delete Iteration

Delete Iteration

HTTP Request

DELETE http://example.com/v1/iterations/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Iteration to be deleted

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- The current user is not associated with this resource
422Unprocessable Entity -- Invalid Params. See response body for more info.

Logs

‘A Student logs their activity during the Project’

Students must log their activity regularly for a Project, in order to prove that they are working on the Project. The logs can influence a Project’s health.

Attributes

Parameter Type Description
date_worked Integer The date that the Student did the work. Should an Integer in Unix Time.
date_submitted Integer The date that the submission was made. It is autocompleted by the System in order to assure its integrity. Should an Integer in Unix Time.
time_worked Integer The time that the Student spent working on the date_worked. Should an Integer in Unix Time.
stage string The stage of the Project that the user was working on. Could be 'Analysis’, 'Design’, 'Implementation’ or any other arbitrary stage.
text string Free text that elaborates on the work done.

Relationships

Logs Relationships

Get Student's logs for Project

Request

GET /projects/12/logs?student_id=38
{
  "student_id": "38",
  "id": "1"
}

Response

Status: 200 -- OK
{
  "logs": [
    {
      "text": "Worked on database and use cases",
      "stage": "Analysis",
      "date_worked": "1493937737",
      "time_worked": "36000",
      "date_submitted": "1494024137"
    },
    {
      "text": "Worked on database and use cases",
      "stage": "Analysis",
      "date_worked": "1493937737",
      "time_worked": "36000",
      "date_submitted": "1494024137"
    }
  ]
}

Get all the logs for a specific Student, in a Specific Project

HTTP Request

GET http://example.com/v1/projects/:id/logs

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the project, for which the logs will be returned
requiredstudent_idIntegerThe id of the student, for which the logs will be returned

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- The id does not belong to any project associated with the current user
422Unprocessable Entity -- The student_id does not match any Student in the Project

Get Logs for Project

Request

GET /projects/12/logs
{
  "id": "1"
}

Response

Status: 200 -- OK
{
  "logs": [
    {
      "text": "Worked on database and use cases",
      "stage": "Analysis",
      "date_worked": "1493937737",
      "time_worked": "36000",
      "date_submitted": "1494024137"
    },
    {
      "text": "Worked on database and use cases",
      "stage": "Analysis",
      "date_worked": "1493937737",
      "time_worked": "36000",
      "date_submitted": "1494024137"
    }
  ]
}

Get all of the completed Logs for a specific Project.

HTTP Request

GET http://example.com/v1/projects/:id/logs

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe Logs will be returned for this Project

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Student. This endpoint is only available to Students.
403Forbidden -- The current user is not associated with this resource

New Log Entry

Request

POST /projects/12/logs
{
  "date_submitted": "1494024137",
  "date_worked": "1493937737",
  "stage": "Analysis",
  "text": "Worked on database and use cases",
  "time_worked": "36000",
  "id": "1"
}

Response

Status: 201 -- Created
{
  "log_entry": {
    "date_worked": "1493937737",
    "time_worked": "36000",
    "date_submitted": "1494024137",
    "stage": "Analysis",
    "text": "Worked on database and use cases"
  },
  "points": {
    "points_earned": 7,
    "new_total": 7,
    "detailed": {
      "log": [
        {
          "points": 7,
          "reason_id": 3
        }
      ]
    }
  }
}

Request (Error)

POST /projects/12/logs
{
  "date_worked": "1493937737",
  "stage": "Analysis",
  "text": "Worked on database and use cases",
  "id": "1"
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "log_entry": [
      "parameter is missing from new entry. Keys should be date_worked, time_worked, stage, text."
    ]
  }
}

Create a new Log entry for a Project. The current time will be saved as `date_submitted` by the server. A Student can not update a Log after they have submitted it.

HTTP Request

POST http://example.com/v1/projects/:id/logs

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Project that the log will be for
requireddate_workedIntegerThe date that the Student did the work. Should be in Unix Time.
requiredtime_workedIntegerThe time that the Student spent working on the project. Should be in Unix Time.
requiredstageStringThe stage of the Project that the user was working on. Could be 'Analysis', 'Design', 'Implementation' or any other arbitrary stage.
requiredtextStringFree text that elaborates on the work done.

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Student. This endpoint is only available to Students.
403Forbidden -- The current user is not associated with this resource
422Unprocessable Entity -- Invalid Params. See response body for more info.

PA Forms

‘PA Forms (Peer Assessment Forms) are complted by Students for other Students’

A PA Form is created by the Lecturer for each Iteration. Students have to assess their teammates with this form for every Iteration of the Project. After a Lecturer creates a new PaForm, the system saves the Questions used, to enable the Lecturer to reuse them in future forms. The system automatically checks if a Question has already been saved before creating a new record.

Attributes

Parameter Type Description
iteration_id Integer The id of the Iteration that the PA Form belongs to
start_date Integer The id of the Student that was assessed
end_date Integer The id of the PAForm that was completed in the assessment
questions JSON The questions of the form. See “Questions Format” below for explanation

Questions Format

Questions are submitted and saved as a JSON array of JSON objects that contain the 'question_id’, the 'text’ of the question, and its 'type_id’, which corresponds to the id of one of the available QuestionTypes. Questions should be submitted in the following format:

questions: [ { text: 'Question?', type_id: 2 } ]

Example

{
  "questions": [
    {
      "text": "Did this person work hard?",
      "type_id": 2
    },
    {
      "text": "Did they deliver the work in time?",
      "type_id": 1
    },
    {
      "text": "Die they exhbit leadership skills?",
      "type_id": 2
    }
  ]
}

The questions format will be validated, and input will be rejected if it does not follow the above example.

Relationships

PA Form Relationships

Create new PA Form

Request

POST /pa_forms
{
  "deadline": "2017-09-29 00:00:00 UTC",
  "iteration_id": "1",
  "questions": [
    {
      "text": "Who is it?",
      "type_id": "4"
    },
    {
      "text": "Human?",
      "type_id": "4"
    },
    {
      "text": "Hello?",
      "type_id": "3"
    },
    {
      "text": "Favorite Power Ranger?",
      "type_id": "4"
    }
  ],
  "start_date": "2017-09-27 00:00:00 UTC"
}

Response

Status: 201 -- Created
{
  "pa_form": {
    "id": 3,
    "iteration_id": 1,
    "questions": [
      {
        "question_id": 1,
        "text": "Who is it?",
        "type_id": "4"
      },
      {
        "question_id": 2,
        "text": "Human?",
        "type_id": "4"
      },
      {
        "question_id": 3,
        "text": "Hello?",
        "type_id": "3"
      },
      {
        "question_id": 4,
        "text": "Favorite Power Ranger?",
        "type_id": "4"
      }
    ],
    "start_date": "2017-09-27T03:00:00.000+03:00",
    "deadline": "2017-09-29T03:00:00.000+03:00"
  }
}

Request (Error)

POST /pa_forms
{
  "iteration_id": "1",
  "questions": "Who is it?"
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "questions": [
      "can't be blank"
    ],
    "start_offset": [
      "can't be blank"
    ],
    "end_offset": [
      "can't be blank"
    ],
    "deadline": [
      "can't be before the start_date"
    ]
  }
}

Create a new PAForm for an Assignment

HTTP Request

POST http://example.com/v1/pa_forms

Query Parameters

RequiredParameterTypeDesription
requirediteration_idIntegerThe id of the Iteration that the PA Form belongs to
requiredstart_dateDateTimeThe date from which the form is available to the Students for completion.
requireddeadlineDateTimeThe deadline after which the form will not be able to be completed by the Students. In Unix Time.
requiredquestionsJSONThe questions of the form. See 'Questions Format' section for information about the format

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- The iteration_id does not belong to a project associated with current_user
422Unprocessable Entity -- Invalid Params. See response body for more info.

Create same PA Form for all Iterations

Request

POST /assignments/1/pa_forms
{
  "end_offset": "259200",
  "questions": [
    {
      "text": "Who is it?",
      "type_id": "8"
    },
    {
      "text": "Human?",
      "type_id": "8"
    },
    {
      "text": "Hello?",
      "type_id": "7"
    },
    {
      "text": "Favorite Power Ranger?",
      "type_id": "8"
    }
  ],
  "start_offset": "86400",
  "assignment_id": "4"
}

Response

Status: 201 -- Created
{
  "pa_forms": [
    {
      "id": 5,
      "iteration_id": 4,
      "questions": [
        {
          "question_id": 1,
          "text": "Who is it?",
          "type_id": "8"
        },
        {
          "question_id": 2,
          "text": "Human?",
          "type_id": "8"
        },
        {
          "question_id": 3,
          "text": "Hello?",
          "type_id": "7"
        },
        {
          "question_id": 4,
          "text": "Favorite Power Ranger?",
          "type_id": "8"
        }
      ],
      "start_date": "2017-09-05T03:00:00.000+03:00",
      "deadline": "2017-09-07T03:00:00.000+03:00"
    },
    {
      "id": 6,
      "iteration_id": 5,
      "questions": [
        {
          "question_id": 1,
          "text": "Who is it?",
          "type_id": "8"
        },
        {
          "question_id": 2,
          "text": "Human?",
          "type_id": "8"
        },
        {
          "question_id": 3,
          "text": "Hello?",
          "type_id": "7"
        },
        {
          "question_id": 4,
          "text": "Favorite Power Ranger?",
          "type_id": "8"
        }
      ],
      "start_date": "2017-09-05T03:00:00.000+03:00",
      "deadline": "2017-09-07T03:00:00.000+03:00"
    }
  ]
}

Creates the same PaForm for each Iteration of an Assignment. The Assignment needs to contain at least one Iteration, and no Iteration must already have a PaForm. The dates must also be a start and end offset from the deadline of the Iteration, since the start and deadline of a PaForm depends on the start and end of an Iteration.

Returns the created PaForms.

HTTP Request

POST http://example.com/v1/assignments/:assignment_id/pa_forms

Query Parameters

RequiredParameterTypeDesription
requiredassignment_idIntegerThe id of the Assignment.
requiredstart_offsetIntegerThe time that must pass after the end of an Iteration, before the pa_forms can be sent. In Unix Time.
requiredend_offsetIntegerThe time that must pass after the end of an Iteration, before the pa_forms can be sent. In Unix Time.
requiredquestionsJSONThe questions of the form. See 'Questions Format' section for information about the format

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- The assignment_id does not belong to an Assignment associated with current_user
422Unprocessable Entity -- This assignment has no Iterations.
422Unprocessable Entity -- An Iteration in this Assignment already contains a PaForm.
422Unprocessable Entity -- Invalid Params. See response body for more info.

Get Active PA Forms

Request

GET /pa_forms

Response

Status: 200 -- OK
{
  "pa_forms": [
    {
      "id": 14,
      "iteration_id": 17,
      "questions": [
        {
          "text": "Do you collect anything?",
          "type_id": 21,
          "question_id": 1,
          "question_type": {
            "id": 21,
            "question_type": "text",
            "friendly_name": "name"
          }
        },
        {
          "text": "Have you ever been approached by someone who knew you but you couldn't remember them for the life of you?",
          "type_id": 21,
          "question_id": 2,
          "question_type": {
            "id": 21,
            "question_type": "text",
            "friendly_name": "name"
          }
        },
        {
          "text": "Have you ever been in a helicopter?",
          "type_id": 21,
          "question_id": 3,
          "question_type": {
            "id": 21,
            "question_type": "text",
            "friendly_name": "name"
          }
        },
        {
          "text": "What horror fiction character scares you the most?",
          "type_id": 21,
          "question_id": 4,
          "question_type": {
            "id": 21,
            "question_type": "text",
            "friendly_name": "name"
          }
        },
        {
          "text": "Whats your favourite precious stone?",
          "type_id": 21,
          "question_id": 5,
          "question_type": {
            "id": 21,
            "question_type": "text",
            "friendly_name": "name"
          }
        }
      ],
      "start_date": "2017-05-13T01:42:19.000+03:00",
      "deadline": "2017-05-16T01:42:19.000+03:00",
      "project_id": 4
    }
  ]
}

Request

GET /pa_forms

Response

Status: 200 -- OK
{
  "pa_forms": [
    {
      "id": 25,
      "iteration_id": 27,
      "questions": [
        {
          "text": "Have you ever owned a slinky?",
          "type_id": 26,
          "question_id": 1,
          "question_type": {
            "id": 26,
            "question_type": "text",
            "friendly_name": "name"
          }
        },
        {
          "text": "Can you solve sudoko puzzles?",
          "type_id": 26,
          "question_id": 2,
          "question_type": {
            "id": 26,
            "question_type": "text",
            "friendly_name": "name"
          }
        },
        {
          "text": "What are cooler? Dinosaurs or Dragons?",
          "type_id": 26,
          "question_id": 3,
          "question_type": {
            "id": 26,
            "question_type": "text",
            "friendly_name": "name"
          }
        },
        {
          "text": "What do you like on your toast?",
          "type_id": 26,
          "question_id": 4,
          "question_type": {
            "id": 26,
            "question_type": "text",
            "friendly_name": "name"
          }
        },
        {
          "text": "What historical period would you like to live in if you could go back in time?",
          "type_id": 26,
          "question_id": 5,
          "question_type": {
            "id": 26,
            "question_type": "text",
            "friendly_name": "name"
          }
        }
      ],
      "start_date": "2017-05-13T01:42:19.000+03:00",
      "deadline": "2017-05-16T01:42:19.000+03:00",
      "project_id": 9
    },
    {
      "id": 26,
      "iteration_id": 28,
      "questions": [
        {
          "text": "If you were a member of the spice girls, what would your spice handle be?",
          "type_id": 26,
          "question_id": 1,
          "question_type": {
            "id": 26,
            "question_type": "text",
            "friendly_name": "name"
          }
        },
        {
          "text": "Whats your favourite precious stone?",
          "type_id": 26,
          "question_id": 2,
          "question_type": {
            "id": 26,
            "question_type": "text",
            "friendly_name": "name"
          }
        },
        {
          "text": "What are cooler? Dinosaurs or Dragons?",
          "type_id": 26,
          "question_id": 3,
          "question_type": {
            "id": 26,
            "question_type": "text",
            "friendly_name": "name"
          }
        },
        {
          "text": "Whats your favourite alcoholic drink beginning with the letter V?",
          "type_id": 26,
          "question_id": 4,
          "question_type": {
            "id": 26,
            "question_type": "text",
            "friendly_name": "name"
          }
        },
        {
          "text": "Have you ever tossed your own pancake?",
          "type_id": 26,
          "question_id": 5,
          "question_type": {
            "id": 26,
            "question_type": "text",
            "friendly_name": "name"
          }
        }
      ],
      "start_date": "2017-05-14T01:42:19.000+03:00",
      "deadline": "2017-05-17T01:42:19.000+03:00",
      "project_id": 9,
      "extension_until": "2017-05-19T01:42:19.000+03:00"
    }
  ]
}

Returns all Peer Assessment forms, associated with the current_user, that can be submitted at the moment, meaning that the start_date has passed, but the deadline is still in the future. If there is an extension on pa_form, the new submission date (with the extension) is included inside the pa_form object as 'extension_until'. The forms that have already been completed are excluded from the response.

HTTP Request

GET http://example.com/v1/pa_forms

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Student. This endpoint is only available to Students.
403Forbidden -- The current user is not associated with this resource

Get a Specific PA Form

Request

GET /pa_forms/:id
{
  "id": "1"
}

Response

Status: 200 -- OK
{
  "pa_form": {
    "id": 1,
    "iteration_id": 1,
    "questions": [
      {
        "text": "What do you think the greatest invention has been?",
        "type_id": 1,
        "question_id": 1,
        "question_type": {
          "id": 1,
          "question_type": "text",
          "friendly_name": "name"
        }
      },
      {
        "text": "What historical period would you like to live in if you could go back in time?",
        "type_id": 1,
        "question_id": 2,
        "question_type": {
          "id": 1,
          "question_type": "text",
          "friendly_name": "name"
        }
      },
      {
        "text": "Can you play poker?",
        "type_id": 1,
        "question_id": 3,
        "question_type": {
          "id": 1,
          "question_type": "text",
          "friendly_name": "name"
        }
      },
      {
        "text": "At what age did you twig onto the fact Santa wasnt real?",
        "type_id": 1,
        "question_id": 4,
        "question_type": {
          "id": 1,
          "question_type": "text",
          "friendly_name": "name"
        }
      },
      {
        "text": "Whats your favourite precious stone?",
        "type_id": 1,
        "question_id": 5,
        "question_type": {
          "id": 1,
          "question_type": "text",
          "friendly_name": "name"
        }
      }
    ],
    "start_date": "2017-09-28T03:00:00.000+03:00",
    "deadline": "2017-10-01T03:00:00.000+03:00"
  }
}

Returns a Peer Assessment Form. Must be associated with the current user. If there is an extension on pa_form, the new submission date (with the extension) is included inside the pa_form object as 'extension_until'. It there are any extensions for any team for a pa_form, they are included in 'extensions' inside the 'pa_form' object.

HTTP Request

GET http://example.com/v1/pa_forms/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the PA Form to be returned

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not associated with this resource
400Bad Request -- Invalid 'includes' parameter

Peer Assessments

‘Students submit Peer Assessments about other Students’

A Peer Assessment is submitted for a Student by a Student from the same Team for a PAForm in an Iteration of a Project. It contains the answers to the questions contained in the associated PAForm and the date and time it was submitted. A Student may assess another Student once per iteration.

Attributes

Parameter Type Description
submitted_by_id Integer The id of the Student that submitted the form
submitted_for_id Integer The id of the Student that was assessed
pa_form_id Integer The id of the PAForm that was completed in the assessment
date_submitted DateTime The date and time that the Peer Assessment was completed. Filed in automatically by the server.
answers JSON The anwers to each question of the PAForm. See “Answers Format” above for explanation

Answers Format

Answers are submitted and saved as a JSON array of JSON objects with the id of the question and the answer as a pair.

answers: [ { question_id : answer } ]

Example

{
  "answers": [
    {
      "1": "Answer to question1"
    },
    {
      "2": "Answer to question 2"
    },
    {
      "3": "Answer to question 3"
    }
  ]
}

The answers format will be validated, and input will be rejected if it does not follow the above example.

Relationships

Peer Assessment Relationships

Submit Peer Assessment

Request

POST /peer_assessments
{
  "answers": [
    {
      "answer": "1",
      "question_id": "3"
    },
    {
      "answer": "I enjoyed the presentations",
      "question_id": "2"
    }
  ],
  "pa_form_id": "1",
  "submitted_for_id": "3"
}

Response

Status: 201 -- Created
{
  "peer_assessment": {
    "id": 1,
    "pa_form_id": 1,
    "submitted_by_id": 1,
    "submitted_for_id": 3,
    "date_submitted": "2017-09-24T00:01:00.026Z",
    "answers": [
      {
        "question_id": "3",
        "answer": "1"
      },
      {
        "question_id": "2",
        "answer": "I enjoyed the presentations"
      }
    ]
  },
  "points": {
    "points_earned": 30,
    "new_total": 30,
    "detailed": {
      "peer_assessment": [
        {
          "points": 10,
          "reason_id": 1,
          "resource_id": 1
        },
        {
          "points": 10,
          "reason_id": 5,
          "resource_id": 1
        },
        {
          "points": 10,
          "reason_id": 8,
          "resource_id": 1
        }
      ]
    }
  }
}

Example: Mutliple Peer Assessments

Request

POST /peer_assessments
{
  "peer_assessments": [
    {
      "pa_form_id": 3,
      "submitted_for_id": 29,
      "answers": [
        {
          "question_id": 3,
          "answer": 1
        },
        {
          "question_id": 2,
          "answer": "I enjoyed the presentations"
        }
      ]
    },
    {
      "pa_form_id": 3,
      "submitted_for_id": 30,
      "answers": [
        {
          "question_id": 3,
          "answer": 1
        },
        {
          "question_id": 2,
          "answer": "I enjoyed the presentations"
        }
      ]
    }
  ],
  "format": "json",
  "peer_assessment": {
  }
}

Response

Status: 201 -- Created
{
  "peer_assessments": [
    {
      "id": 3,
      "pa_form_id": 3,
      "submitted_by_id": 1,
      "submitted_for_id": 29,
      "date_submitted": "2017-10-23T00:01:00.025Z",
      "answers": [
        {
          "question_id": 3,
          "answer": 1
        },
        {
          "question_id": 2,
          "answer": "I enjoyed the presentations"
        }
      ]
    },
    {
      "id": 4,
      "pa_form_id": 3,
      "submitted_by_id": 1,
      "submitted_for_id": 30,
      "date_submitted": "2017-10-23T00:01:00.056Z",
      "answers": [
        {
          "question_id": 3,
          "answer": 1
        },
        {
          "question_id": 2,
          "answer": "I enjoyed the presentations"
        }
      ]
    }
  ],
  "points": {
    "points_earned": 20,
    "new_total": 20,
    "detailed": {
      "peer_assessment": [
        {
          "points": 10,
          "reason_id": 1,
          "resource_id": 3
        },
        {
          "points": 10,
          "reason_id": 8,
          "resource_id": 3
        }
      ]
    }
  }
}

Example: Invalid Answers Format

Request (Error)

POST /peer_assessments
{
  "answers": {
    "answer": "dkdk",
    "question_id": "3",
    "something": "ddd"
  },
  "pa_form_id": "5",
  "submitted_for_id": "55"
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "answers": [
      "is not an array"
    ]
  }
}

Submit a Peer Assessment for another Student. Students should evaluate their teammates once per iteration. The current time will be saved as `date_submitted` by the server. The server will return an error if the deadline for the Peer Assessment has passed, or the start date is in the future. A Student can not update a Peer Assessment after they have submitted it.

Submit Multiple Peer Assessments

To submit more than one Peer Assessments with one request, the body of the request should contain an object called "peer_assessments", that points to any array whose elements is each individual Peer Assessment record.

{ "peer_assessments": [ { "answers": [ { "answer": "1", "question_id": "3" }, { "answer": "I enjoyed the presentations", "question_id": "2" } ], "pa_form_id": "1", "submitted_for_id": "3" }, { "answers": [ { "answer": "1", "question_id": "3" }, { "answer": "I enjoyed the presentations", "question_id": "2" } ], "pa_form_id": "1", "submitted_for_id": "3" }, { "answers": [ { "answer": "1", "question_id": "3" }, { "answer": "I enjoyed the presentations", "question_id": "2" } ], "pa_form_id": "1", "submitted_for_id": "3" } ] }

HTTP Request

POST http://example.com/v1/peer_assessments

Query Parameters

RequiredParameterTypeDesription
requiredpa_form_idIntegerThe id of the PAForm that was completed.
requiredsubmitted_for_idIntegerThe id of the Student that was evaluated
requiredanswersJSONThe anwers to each question of the PAForm. See 'Answers Format' section for information about the format

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Student. This endpoint is only available to Students.
403Forbidden -- The current user is not associated with this resource
422Unprocessable Entity -- Invalid Params. See response body for more info.

Get Peer Assessments

Example: Get all that were Submitted by a specific Student for a specific PAForm

Request

GET /peer_assessments
{
  "pa_form_id": "6",
  "submitted_by_id": "1"
}

Response

Status: 200 -- OK
{
  "peer_assessments": [
    {
      "id": 5,
      "pa_form_id": 6,
      "submitted_by_id": 1,
      "submitted_for_id": 68,
      "date_submitted": "2017-09-07T02:00:00.000Z",
      "answers": [
        {
          "answer": "Something",
          "question_id": 1
        },
        {
          "answer": "A guy",
          "question_id": 2
        },
        {
          "answer": "Yesterwhatever",
          "question_id": 3
        },
        {
          "answer": "You know where",
          "question_id": 4
        },
        {
          "answer": "Because",
          "question_id": 5
        }
      ]
    },
    {
      "id": 6,
      "pa_form_id": 6,
      "submitted_by_id": 1,
      "submitted_for_id": 69,
      "date_submitted": "2017-09-07T02:00:00.000Z",
      "answers": [
        {
          "answer": "Something",
          "question_id": 1
        },
        {
          "answer": "A guy",
          "question_id": 2
        },
        {
          "answer": "Yesterwhatever",
          "question_id": 3
        },
        {
          "answer": "You know where",
          "question_id": 4
        },
        {
          "answer": "Because",
          "question_id": 5
        }
      ]
    },
    {
      "id": 7,
      "pa_form_id": 6,
      "submitted_by_id": 1,
      "submitted_for_id": 70,
      "date_submitted": "2017-09-07T02:00:00.000Z",
      "answers": [
        {
          "answer": "Something",
          "question_id": 1
        },
        {
          "answer": "A guy",
          "question_id": 2
        },
        {
          "answer": "Yesterwhatever",
          "question_id": 3
        },
        {
          "answer": "You know where",
          "question_id": 4
        },
        {
          "answer": "Because",
          "question_id": 5
        }
      ]
    },
    {
      "id": 8,
      "pa_form_id": 6,
      "submitted_by_id": 1,
      "submitted_for_id": 71,
      "date_submitted": "2017-09-07T02:00:00.000Z",
      "answers": [
        {
          "answer": "Something",
          "question_id": 1
        },
        {
          "answer": "A guy",
          "question_id": 2
        },
        {
          "answer": "Yesterwhatever",
          "question_id": 3
        },
        {
          "answer": "You know where",
          "question_id": 4
        },
        {
          "answer": "Because",
          "question_id": 5
        }
      ]
    }
  ]
}

Request

GET /peer_assessments
{
  "pa_form_id": "6",
  "submitted_for_id": "1"
}

Response

Status: 200 -- OK
{
  "peer_assessments": [
    {
      "id": 9,
      "pa_form_id": 6,
      "submitted_by_id": 68,
      "submitted_for_id": 1,
      "date_submitted": "2017-09-07T02:00:00.000Z",
      "answers": [
        {
          "answer": "Something",
          "question_id": 1
        },
        {
          "answer": "A guy",
          "question_id": 2
        },
        {
          "answer": "Yesterwhatever",
          "question_id": 3
        },
        {
          "answer": "You know where",
          "question_id": 4
        },
        {
          "answer": "Because",
          "question_id": 5
        }
      ]
    }
  ]
}

Example: All Peer Assessments for a specific Project

Request

GET /peer_assessments
{
  "project_id": "11"
}

Response

Status: 200 -- OK
{
  "peer_assessments": [
    {
      "id": 5,
      "pa_form_id": 6,
      "submitted_by_id": 1,
      "submitted_for_id": 68,
      "date_submitted": "2017-09-07T02:00:00.000Z",
      "answers": [
        {
          "answer": "Something",
          "question_id": 1
        },
        {
          "answer": "A guy",
          "question_id": 2
        },
        {
          "answer": "Yesterwhatever",
          "question_id": 3
        },
        {
          "answer": "You know where",
          "question_id": 4
        },
        {
          "answer": "Because",
          "question_id": 5
        }
      ]
    },
    {
      "id": 6,
      "pa_form_id": 6,
      "submitted_by_id": 1,
      "submitted_for_id": 69,
      "date_submitted": "2017-09-07T02:00:00.000Z",
      "answers": [
        {
          "answer": "Something",
          "question_id": 1
        },
        {
          "answer": "A guy",
          "question_id": 2
        },
        {
          "answer": "Yesterwhatever",
          "question_id": 3
        },
        {
          "answer": "You know where",
          "question_id": 4
        },
        {
          "answer": "Because",
          "question_id": 5
        }
      ]
    },
    {
      "id": 7,
      "pa_form_id": 6,
      "submitted_by_id": 1,
      "submitted_for_id": 70,
      "date_submitted": "2017-09-07T02:00:00.000Z",
      "answers": [
        {
          "answer": "Something",
          "question_id": 1
        },
        {
          "answer": "A guy",
          "question_id": 2
        },
        {
          "answer": "Yesterwhatever",
          "question_id": 3
        },
        {
          "answer": "You know where",
          "question_id": 4
        },
        {
          "answer": "Because",
          "question_id": 5
        }
      ]
    },
    {
      "id": 8,
      "pa_form_id": 6,
      "submitted_by_id": 1,
      "submitted_for_id": 71,
      "date_submitted": "2017-09-07T02:00:00.000Z",
      "answers": [
        {
          "answer": "Something",
          "question_id": 1
        },
        {
          "answer": "A guy",
          "question_id": 2
        },
        {
          "answer": "Yesterwhatever",
          "question_id": 3
        },
        {
          "answer": "You know where",
          "question_id": 4
        },
        {
          "answer": "Because",
          "question_id": 5
        }
      ]
    },
    {
      "id": 9,
      "pa_form_id": 6,
      "submitted_by_id": 68,
      "submitted_for_id": 1,
      "date_submitted": "2017-09-07T02:00:00.000Z",
      "answers": [
        {
          "answer": "Something",
          "question_id": 1
        },
        {
          "answer": "A guy",
          "question_id": 2
        },
        {
          "answer": "Yesterwhatever",
          "question_id": 3
        },
        {
          "answer": "You know where",
          "question_id": 4
        },
        {
          "answer": "Because",
          "question_id": 5
        }
      ]
    },
    {
      "id": 10,
      "pa_form_id": 6,
      "submitted_by_id": 68,
      "submitted_for_id": 69,
      "date_submitted": "2017-09-07T02:00:00.000Z",
      "answers": [
        {
          "answer": "Something",
          "question_id": 1
        },
        {
          "answer": "A guy",
          "question_id": 2
        },
        {
          "answer": "Yesterwhatever",
          "question_id": 3
        },
        {
          "answer": "You know where",
          "question_id": 4
        },
        {
          "answer": "Because",
          "question_id": 5
        }
      ]
    },
    {
      "id": 11,
      "pa_form_id": 6,
      "submitted_by_id": 68,
      "submitted_for_id": 70,
      "date_submitted": "2017-09-07T02:00:00.000Z",
      "answers": [
        {
          "answer": "Something",
          "question_id": 1
        },
        {
          "answer": "A guy",
          "question_id": 2
        },
        {
          "answer": "Yesterwhatever",
          "question_id": 3
        },
        {
          "answer": "You know where",
          "question_id": 4
        },
        {
          "answer": "Because",
          "question_id": 5
        }
      ]
    },
    {
      "id": 12,
      "pa_form_id": 6,
      "submitted_by_id": 68,
      "submitted_for_id": 71,
      "date_submitted": "2017-09-07T02:00:00.000Z",
      "answers": [
        {
          "answer": "Something",
          "question_id": 1
        },
        {
          "answer": "A guy",
          "question_id": 2
        },
        {
          "answer": "Yesterwhatever",
          "question_id": 3
        },
        {
          "answer": "You know where",
          "question_id": 4
        },
        {
          "answer": "Because",
          "question_id": 5
        }
      ]
    }
  ]
}

Request (Error)

GET /peer_assessments

Response

Status: 400 -- Bad Request
{
  "errors": {
    "base": [
      "There was no pa_form_id in the params. Try again with a pa_form_id in the params for all peer assessments for that PAForm, or with either a pa_form_id and a submitted_by_id or a pa_form_id and a submitted_for_id for specific Student's peer assessments."
    ]
  }
}

Get Peer Assessments based on the parameter passed. Can get Peer Assessments for a Project, Iterations, PAForm, Student that submitted the form, Student that the form was submitted for or any combination of the above. Basically, the database will be queried with the parameters provided. See 'Attributes' for a complete list of available options. At least ONE of them must be present, or the request will produce and error.

HTTP Request

GET http://example.com/v1/peer_assessments

Query Parameters

RequiredParameterTypeDesription
pa_form_idIntegerUsed to get all Peer Assessments that were submitted for a specific PAForm
submitted_by_idIntegerUsed to get all Peer Assessments that were submitted BY a specific Student
submitted_for_idIntegerUsed to get all Peer Asesssments that were submitted FOR a specific student
iteration_idIntegerUsed to get all Peer Assessments that were submitted during a specific Assignment Iteration
project_idIntegerUsed to get all Peer Assessments that were submitted for a specific Project

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
400Bad Request -- No relevant parameter was found. This endpoint must have at least one of the following: pa_form_id, submitted_by_id, submitted_for_id, project_id, iteration_id
400Bad Request -- Invalid 'includes' parameter
403Forbidden -- The current user is not associated with this resource

Get Peer Assessments

Example: Get all that were Submitted by a specific Student for a specific PAForm

Request

GET /peer_assessments
{
  "pa_form_id": "6",
  "submitted_by_id": "1"
}

Response

Status: 200 -- OK
{
  "peer_assessments": [
    {
      "id": 5,
      "pa_form_id": 6,
      "submitted_by_id": 1,
      "submitted_for_id": 68,
      "date_submitted": "2017-09-07T02:00:00.000Z"
    },
    {
      "id": 6,
      "pa_form_id": 6,
      "submitted_by_id": 1,
      "submitted_for_id": 69,
      "date_submitted": "2017-09-07T02:00:00.000Z"
    },
    {
      "id": 7,
      "pa_form_id": 6,
      "submitted_by_id": 1,
      "submitted_for_id": 70,
      "date_submitted": "2017-09-07T02:00:00.000Z"
    },
    {
      "id": 8,
      "pa_form_id": 6,
      "submitted_by_id": 1,
      "submitted_for_id": 71,
      "date_submitted": "2017-09-07T02:00:00.000Z"
    }
  ]
}

Request

GET /peer_assessments
{
  "pa_form_id": "6",
  "submitted_for_id": "1"
}

Response

Status: 200 -- OK
{
  "peer_assessments": [
    {
      "id": 9,
      "pa_form_id": 6,
      "submitted_by_id": 68,
      "submitted_for_id": 1,
      "date_submitted": "2017-09-07T02:00:00.000Z"
    }
  ]
}

Example: All Peer Assessments for a specific Project

Request

GET /peer_assessments
{
  "project_id": "11"
}

Response

Status: 200 -- OK
{
  "peer_assessments": [
    {
      "id": 5,
      "pa_form_id": 6,
      "submitted_by_id": 1,
      "submitted_for_id": 68,
      "date_submitted": "2017-09-07T02:00:00.000Z"
    },
    {
      "id": 6,
      "pa_form_id": 6,
      "submitted_by_id": 1,
      "submitted_for_id": 69,
      "date_submitted": "2017-09-07T02:00:00.000Z"
    },
    {
      "id": 7,
      "pa_form_id": 6,
      "submitted_by_id": 1,
      "submitted_for_id": 70,
      "date_submitted": "2017-09-07T02:00:00.000Z"
    },
    {
      "id": 8,
      "pa_form_id": 6,
      "submitted_by_id": 1,
      "submitted_for_id": 71,
      "date_submitted": "2017-09-07T02:00:00.000Z"
    },
    {
      "id": 9,
      "pa_form_id": 6,
      "submitted_by_id": 68,
      "submitted_for_id": 1,
      "date_submitted": "2017-09-07T02:00:00.000Z"
    }
  ]
}

Request (Error)

GET /peer_assessments

Response

Status: 400 -- Bad Request
{
  "errors": {
    "base": [
      "There was no pa_form_id in the params. Try again with a pa_form_id in the params for all peer assessments for that PAForm, or with either a pa_form_id and a submitted_by_id or a pa_form_id and a submitted_for_id for specific Student's peer assessments."
    ]
  }
}

Get Peer Assessments based on the parameter passed. Can get Peer Assessments for a Project, Iterations, PAForm, Student that submitted the form, Student that the form was submitted for or any combination of the above. Basically, the database will be queried with the parameters provided. See 'Attributes' for a complete list of available options. At least ONE of them must be present, or the request will produce and error. The answers to the Peer Assessments are not available to the Students for privacy reasons.

HTTP Request

GET http://example.com/v1/peer_assessments

Query Parameters

RequiredParameterTypeDesription
pa_form_idIntegerUsed to get all Peer Assessments that were submitted for a specific PAForm
submitted_by_idIntegerUsed to get all Peer Assessments that were submitted BY a specific Student
submitted_for_idIntegerUsed to get all Peer Asesssments that were submitted FOR a specific student
iteration_idIntegerUsed to get all Peer Assessments that were submitted during a specific Assignment Iteration
project_idIntegerUsed to get all Peer Assessments that were submitted for a specific Project

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
400Bad Request -- No relevant parameter was found. This endpoint must have at least one of the following: pa_form_id, submitted_by_id, submitted_for_id, project_id, iteration_id
400Bad Request -- Invalid 'includes' parameter
403Forbidden -- The current user is not associated with this resource

Get Specific Peer Assessment

Request

GET /peer_assessments/:id
{
  "id": "5"
}

Response

Status: 200 -- OK
{
  "peer_assessment": {
    "id": 5,
    "pa_form_id": 6,
    "submitted_by_id": 1,
    "submitted_for_id": 68,
    "date_submitted": "2017-09-07T02:00:00.000Z",
    "answers": [
      {
        "answer": "Something",
        "question_id": 1
      },
      {
        "answer": "A guy",
        "question_id": 2
      },
      {
        "answer": "Yesterwhatever",
        "question_id": 3
      },
      {
        "answer": "You know where",
        "question_id": 4
      },
      {
        "answer": "Because",
        "question_id": 5
      }
    ]
  }
}

Get a specific Peer Assessment. Must be associated with the current user

HTTP Request

GET http://example.com/v1/peer_assessments/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Peer Assessment to be returned

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
400Bad Request -- Invalid 'includes' parameter
403Forbidden -- The current user is not associated with this resource

Get Specific Peer Assessment

Request

GET /peer_assessments/:id
{
  "id": "5"
}

Response

Status: 200 -- OK
{
  "peer_assessment": {
    "id": 5,
    "pa_form_id": 6,
    "submitted_by_id": 1,
    "submitted_for_id": 68,
    "date_submitted": "2017-09-07T02:00:00.000Z"
  }
}

Get a specific Peer Assessment. Must be associated with the current user. The answers to the Peer Assessment are not available to the Students for privacy reasons.

HTTP Request

GET http://example.com/v1/peer_assessments/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Peer Assessment to be returned

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
400Bad Request -- Invalid 'includes' parameter
403Forbidden -- The current user is not associated with this resource

Points

‘A Student earns points for their team by performing various actions’

Introduction

Points are part of the gamification aspect of the system, and they are awarded to a student for performing certain actions. Actions that get awarded points are 'Submitting a Peer assessment’, 'Submitting a Project evaluation’, and 'Submitting a new Log Entry’. Upon successful submission, the points earned can be found in the response received. There are also endpoints specifically aimed at getting the points for a specific Project or Assignment.

This is what a response for a successful log submission looks like:

{
  "log_entry": {
    "date_worked": "1492376866",
    "time_worked": "36000",
    "date_submitted": "1492463266",
    "stage": "Analysis",
    "text": "Worked on database and use cases"
  },
  "points": {
    "points_earned": 10,
    "new_total": 10,
    "detailed": {
      "log": [
        {
          "points": 10,
          "reason_id": 3
        }
      ]
    }
  }
}

The attribute 'points_earned’ refers to the total point earned from the action, while the “new_total” represents the updated points of the student for the specific Project. Inside “detailed”, a complete report of the points gained can be found, which is categorized by resource (log, peer_assessment, project_evaluation). The resource is used as a key, pointing to an Array containg multiple 'Points hashes’. In the hashes, one can find the number of points awarded, as well as the id of the reason for awarding them.

For example, the reason with id 3 corresponds to “Points gained for submitting a Log”. Although the resources used as keys are currently mutually exclusive (one can not gain points for submitting a log by submitting a peer assessment), by formatting the results in this way it is possible to support arbitrary reasons for gaining points, that do not necessarily align with the submitted resource.

Point Awardable Actions

A student may gain points by completing any of the follwing tasks:

Peer Assessment

Submit a Peer Assessment

A Student automatically gains points when they submit a Peer Assessment.

Submit a Peer Assessment first in their Team

A Student gets extra points if they submitted the Peer Assessment before their teammates.

Submit a Peer Assessment on the First day that it is available

A Student gets extra points if they submitted the Peer Assessment on the first day that it is available for completion.

Project Evaluation

Submit a Project Evaluation

A Student automatically gains points when they submit a Project Evaluation.

Submit a Project Evaluation first in their Team

A Student gets extra points if they submitted the Project Evaluation before their teammates.

Submit a Project Evaluation the First day that it is available

A Student gets extra points if they submitted the Project Evaluation on the first day that it is available for completion.

Log

Submit a Log

A Student automatically gains points when they submit a Log Entry. For the first log of the day, they get the full points that this reason awards. The Student receives a portion of the full points for each subsequent log entry of the day, until they reach the limit set by the 'max_logs_per_day’ GameSetting of the project, at which point they sto receiving points for submitting logs for the reast of the day. The cycle begins again 24 hours later.

Submit the first Log of the Day

A Student get extra points for submitting the first log of the day.

Reasons

Reason ID Description
1 Points gained for submitting a Peer Assessment.
2 Points gained for submitting a Project Evaluation.
3 Points gained for submitting a Log.
4 Points gained for submitting the first log of the day.
5 Points gained for being the first person in a team to submit a peer assessment.
6 Points gained for being the first person in a team to submit a project evaluation.
7 Points gained for submitting the ProjectEvaluation during on the first day that it is available.
8 Points gained for submitting the PeerAssessment during the first day that it is available.

Attributes

Parameter Type Description
personal Integer For Students Only. The number of points in a particular project.
team_average Integer The average points of a Project.
team_points Integer The sum of all the students’ points in the Project.
my_team Boolean For Students Only. Indicates whether a project is the one that the current user belongs to.
points_earned Integer For Students Only. Is included in the response of a succesfull submission of a points awardable action. Indicates the new points earned from this action.
detailed Hash Contains a hash with keys corresponding to point awardable resources, which in turn point to an Array of each point earned.

Get Points for Project ID

Request

GET /projects/1/points
{
  "project_id": "1"
}

Response

Status: 200 -- OK
{
  "points": {
    "project_name": "Project 171",
    "team_name": "The xmen171",
    "logo": null,
    "color": "#c5d2ac",
    "average": 33,
    "total": 100,
    "previous_rank": null,
    "current_rank": 1
  }
}

Get information about the Points of a Project. The Lecturer has to associated with the Project.

HTTP Request

GET http://example.com/v1/projects/:id/points

Query Parameters

RequiredParameterTypeDesription
requiredproject_idIntegerThe id of the project, for which the points will be returned

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The id does not belong to any project associated with the current user

Get Points for Project ID

Request

GET /projects/1/points
{
  "project_id": "1"
}

Response

Status: 200 -- OK
{
  "points": {
    "project_name": "Project 171",
    "team_name": "The xmen171",
    "logo": null,
    "color": "#c5d2ac",
    "average": 20,
    "total": 60,
    "previous_rank": null,
    "current_rank": 1,
    "personal": 10
  }
}

Get information about the Points of a Project. The Student has to be a member of this Project.

HTTP Request

GET http://example.com/v1/projects/:id/points

Query Parameters

RequiredParameterTypeDesription
requiredproject_idIntegerThe id of the project, for which the points will be returned

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The id does not belong to any project associated with the current user

Get Points for Assignment ID

Request

GET /assignments/1/points
{
  "assignment_id": "1"
}

Response

Status: 200 -- OK
{
  "points": [
    {
      "project_id": 9,
      "project_name": "Project 179",
      "logo": null,
      "color": "#b7acd2",
      "team_name": "The xmen179",
      "total": 0,
      "average": 0,
      "previous_rank": null,
      "current_rank": 1
    },
    {
      "project_id": 8,
      "project_name": "Project 178",
      "logo": null,
      "color": "#acb6d2",
      "team_name": "The xmen178",
      "total": 0,
      "average": 0,
      "previous_rank": null,
      "current_rank": 1
    },
    {
      "project_id": 1,
      "project_name": "Project 171",
      "logo": null,
      "color": "#c5d2ac",
      "team_name": "The xmen171",
      "total": 0,
      "average": 0,
      "previous_rank": null,
      "current_rank": 1
    }
  ]
}

Get information about the Points of each Project in an Assignment. The Lecturer has to associated with the Project.

HTTP Request

GET http://example.com/v1/assignments/:id/points

Query Parameters

RequiredParameterTypeDesription
requiredassignment_idIntegerThe id of the Assignment, for which the points for its projects will be returned.

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The id does not belong to any project associated with the current user

Get Points for Assignment ID

Request

GET /assignments/1/points
{
  "assignment_id": "1"
}

Response

Status: 200 -- OK
{
  "points": [
    {
      "project_id": 5,
      "project_name": "Project 175",
      "logo": null,
      "color": "#d2ccac",
      "team_name": "The xmen175",
      "total": 0,
      "average": 0,
      "previous_rank": null,
      "current_rank": 2
    },
    {
      "project_id": 4,
      "project_name": "Project 174",
      "logo": null,
      "color": "#afacd2",
      "team_name": "The xmen174",
      "total": 0,
      "average": 0,
      "previous_rank": null,
      "current_rank": 2
    },
    {
      "project_id": 1,
      "project_name": "Project 171",
      "logo": null,
      "color": "#c5d2ac",
      "team_name": "The xmen171",
      "total": 9,
      "average": 9,
      "previous_rank": null,
      "current_rank": 1,
      "my_team": true,
      "personal": 9
    }
  ]
}

Get information about the Points of each Project in an Assignment. The Student must be associated with the Assignment.

HTTP Request

GET http://example.com/v1/assignments/:id/points

Query Parameters

RequiredParameterTypeDesription
requiredassignment_idIntegerThe id of the Assignment, for which the points for its projects will be returned.

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The id does not belong to any project associated with the current user

Get Reasons

Request

GET /reasons

Response

Status: 200 -- OK
{
  "reasons": {
    "peer_assessment": {
      "id": 1,
      "description": "Points gained for submitting a Peer Assessment.",
      "message": null
    },
    "project_evaluation": {
      "id": 2,
      "description": "Points gained for submitting a Project Evaluation.",
      "message": null
    },
    "log": {
      "id": 3,
      "description": "Points gained for submitting a Log."
    },
    "log_first_of_day": {
      "id": 4,
      "description": "Points gained for submitting the first log of the day.",
      "message": null
    },
    "peer_assessment_first_of_team": {
      "id": 5,
      "description": "Points gained for being the first person in a team to submit a peer assessment.",
      "message": null
    },
    "project_evaluation_first_of_team": {
      "id": 6,
      "description": "Points gained for being the first person in a team to submit a project evaluation.",
      "message": null
    },
    "project_evaluation_submitted_first_day": {
      "id": 7,
      "description": "Points gained for submitting the ProjectEvaluation during on the first day that it is available."
    },
    "peer_assessment_submitted_first_day": {
      "id": 8,
      "description": "Points gained for submitting the PeerAssessment during the first day that it is available."
    }
  }
}

Get the reasons file in JSON form, containing all the Reasons that Points may be awarded to a Student. Contains an 'id' for the Reason, a 'description' and an optional message to show to the Student upon receiving Points for that Reason.

HTTP Request

GET http://example.com/v1/reasons

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed

Projects

‘Projects belong to Assignments, and contain many Students’

Projects contain many Students that participate in a Assignment. A Project has an enrollment key, which Student will use to become members of the Project, and by extension, participate in a Assignment. The Lecturer defines the project_name, and the the team_name is autogenerated by the system. The students can change the team_name and the logo if they wish.

A project also contains the field 'pending_project_evaluations’ that indicates if there are pending project evaluations to be completed. If 'pending_project_evaluations’ is true, the response also contains the 'current_iteration_id’ which indicated the iteration that can be evaluated.

Attributes

Parameter Type Description Unique?
assignment_id Integer The id of the Assignment that the project belongs to
unit_id Integer The id of the Unit that the project belongs to
project_name string The name of the Project. Given by the Lecturer. unique for the assignment
team_name string The name of the Team. Given by the Students. unique for the assignment
enrollment_key string The key used by the Student to enrol in the Project.
logo string The logo of the Project in its url form. Usually created by the Students.
pending_project_evaluation boolean If true, then this user can submit a project evaluation
previous_rank Integer The previously held rank of the project in terms of total points gained in relation to the other project is in the Assignment.
current_rank Integer The current rank of the project in terms of total points gained in relation to the other project is in the Assignment.

Relationships

Project Relationships

Enrol

Request

POST /projects/enrol
{
  "enrollment_key": "55b73ea16ba2e7f4b92fa40d0acd5880",
  "id": "13",
  "nickname": "giorgakis"
}

Response

Status: 201 -- Created
{
  "project": {
    "id": 13,
    "assignment_id": 17,
    "project_name": "Project 233",
    "team_name": "The xmen233",
    "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
    "logo": null,
    "enrollment_key": "55b73ea16ba2e7f4b92fa40d0acd5880",
    "unit_id": 27,
    "color": "#acd2c6",
    "pending_project_evaluation": false,
    "points": {
      "total": 0,
      "average": 0,
      "personal": 0
    },
    "nickname": "giorgakis"
  }
}

Request (Error)

POST /projects/enrol
{
  "enrollment_key": "246f0b4620c66678c9141de95830cdff",
  "id": "14"
}

Response

Status: 403 -- Forbidden
{
  "errors": {
    "nickname": [
      "can't be blank"
    ]
  }
}

Request (Error)

POST /projects/enrol
{
  "enrollment_key": "invalidkey",
  "id": "16",
  "nickname": "batman"
}

Response

Status: 403 -- Forbidden
{
  "errors": {
    "enrollment_key": [
      "is invalid"
    ]
  }
}

Enrol in Project. Needs the enrollment key and the id of the project. A Student must specify a nickname for the particular Project. A Student may only belong to one Project per Assignment.

HTTP Request

POST http://example.com/v1/projects/enrol

Query Parameters

RequiredParameterTypeDesription
requiredenrollment_keyStringThe enrollment key specified by the Lecturer in order to enrol in this project
requiredidIntegerThe id of this project. Used in order to distinguish two projects in case they have the same enrollment key
requirednicknameStringThe Student may specify a nickname for the specific project.

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Student. This endpoint is only available to Students.
403Forbidden -- Student tried to join same Project twice
403Forbidden -- Student tried to join two Projects in the same Assignment
403Forbidden -- Wrong enrollment_key/id

Get Projects

Request

GET /projects

Response

Status: 200 -- OK
{
  "projects": [
    {
      "id": 3,
      "assignment_id": 4,
      "project_name": "Project 202",
      "team_name": "The xmen202",
      "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
      "logo": null,
      "enrollment_key": "74703e33d37ee26965900cbe4fa480e3",
      "unit_id": 1,
      "color": "#d2baac",
      "pending_project_evaluation": false,
      "points": {
        "total": 0,
        "average": 0
      }
    },
    {
      "id": 4,
      "assignment_id": 3,
      "project_name": "Project 203",
      "team_name": "The xmen203",
      "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
      "logo": null,
      "enrollment_key": "b663b5f811df0a7bfeeb5c150aaac5c9",
      "unit_id": 1,
      "color": "#acd2b2",
      "pending_project_evaluation": false,
      "points": {
        "total": 0,
        "average": 0
      }
    },
    {
      "id": 5,
      "assignment_id": 3,
      "project_name": "Project 204",
      "team_name": "The xmen204",
      "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
      "logo": null,
      "enrollment_key": "619ec3fb2309c8cf341503f5148b97ab",
      "unit_id": 1,
      "color": "#bdd2ac",
      "pending_project_evaluation": false,
      "points": {
        "total": 0,
        "average": 0
      }
    },
    {
      "id": 6,
      "assignment_id": 3,
      "project_name": "Project 205",
      "team_name": "The xmen205",
      "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
      "logo": null,
      "enrollment_key": "660806e7e88c4eb88cda9f94474a5a5c",
      "unit_id": 1,
      "color": "#acd2c1",
      "pending_project_evaluation": false,
      "points": {
        "total": 0,
        "average": 0
      }
    },
    {
      "id": 1,
      "assignment_id": 4,
      "project_name": "Project 200",
      "team_name": "The xmen200",
      "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
      "logo": null,
      "enrollment_key": "48402e524d3f43ae660669d7f1ec40f3",
      "unit_id": 1,
      "color": "#acb3d2",
      "pending_project_evaluation": false,
      "points": {
        "total": 0,
        "average": 0
      }
    },
    {
      "id": 2,
      "assignment_id": 4,
      "project_name": "Project 201",
      "team_name": "The xmen201",
      "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
      "logo": null,
      "enrollment_key": "a875f3676b49e1de7575f01a5b6137ba",
      "unit_id": 1,
      "color": "#d2b2ac",
      "pending_project_evaluation": false,
      "points": {
        "total": 0,
        "average": 0
      }
    }
  ]
}

Request

GET /projects

Response

Status: 204 -- No Content
{
  ""
}

Returns all the active Projects of the Lecturer. If the field 'pending_project_evaluation' is true then the current user can submit a project evaluation for this project. If 'pending_project_evaluations' is true, the response also contains the 'current_iteration_id' which indicated the iteration that can be evaluated. Also contains the previous and current rank of the Project by calculating the total points of each project in the Assignment.

HTTP Request

GET http://example.com/v1/projects

Errors

Error CodeMeaning
400Bad Request -- Invalid 'includes' parameter
401Unauthorized -- Authentication Failed

Get Projects for Assignment ID

Request

GET /projects

Response

Status: 200 -- OK
{
  "projects": [
    {
      "id": 3,
      "assignment_id": 4,
      "project_name": "Project 202",
      "team_name": "The xmen202",
      "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
      "logo": null,
      "enrollment_key": "74703e33d37ee26965900cbe4fa480e3",
      "unit_id": 1,
      "color": "#d2baac",
      "pending_project_evaluation": false,
      "points": {
        "total": 0,
        "average": 0
      }
    },
    {
      "id": 4,
      "assignment_id": 3,
      "project_name": "Project 203",
      "team_name": "The xmen203",
      "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
      "logo": null,
      "enrollment_key": "b663b5f811df0a7bfeeb5c150aaac5c9",
      "unit_id": 1,
      "color": "#acd2b2",
      "pending_project_evaluation": false,
      "points": {
        "total": 0,
        "average": 0
      }
    },
    {
      "id": 5,
      "assignment_id": 3,
      "project_name": "Project 204",
      "team_name": "The xmen204",
      "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
      "logo": null,
      "enrollment_key": "619ec3fb2309c8cf341503f5148b97ab",
      "unit_id": 1,
      "color": "#bdd2ac",
      "pending_project_evaluation": false,
      "points": {
        "total": 0,
        "average": 0
      }
    },
    {
      "id": 6,
      "assignment_id": 3,
      "project_name": "Project 205",
      "team_name": "The xmen205",
      "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
      "logo": null,
      "enrollment_key": "660806e7e88c4eb88cda9f94474a5a5c",
      "unit_id": 1,
      "color": "#acd2c1",
      "pending_project_evaluation": false,
      "points": {
        "total": 0,
        "average": 0
      }
    },
    {
      "id": 1,
      "assignment_id": 4,
      "project_name": "Project 200",
      "team_name": "The xmen200",
      "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
      "logo": null,
      "enrollment_key": "48402e524d3f43ae660669d7f1ec40f3",
      "unit_id": 1,
      "color": "#acb3d2",
      "pending_project_evaluation": false,
      "points": {
        "total": 0,
        "average": 0
      }
    },
    {
      "id": 2,
      "assignment_id": 4,
      "project_name": "Project 201",
      "team_name": "The xmen201",
      "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
      "logo": null,
      "enrollment_key": "a875f3676b49e1de7575f01a5b6137ba",
      "unit_id": 1,
      "color": "#d2b2ac",
      "pending_project_evaluation": false,
      "points": {
        "total": 0,
        "average": 0
      }
    }
  ]
}

Returns all the Projects for the provided assignment_id. Contains the 'team_points' and the 'team_average'. If the field 'pending_project_evaluation' is true then the current user can submit a project evaluation for this project. If 'pending_project_evaluations' is true, the response also contains the 'current_iteration_id' which indicated the iteration that can be evaluated. Also contains the previous and current rank of the Project by calculating the total points of each project in the Assignment.

HTTP Request

GET http://example.com/v1/projects

Query Parameters

RequiredParameterTypeDesription
requiredassignment_idIntegerReturn all Projects for a specific assignment

Errors

Error CodeMeaning
400Bad Request -- Invalid 'includes' parameter
401Unauthorized -- Authentication Failed

Get Projects for Unit ID

Request

GET /projects
{
  "assignment_id": "4"
}

Response

Status: 200 -- OK
{
  "projects": [
    {
      "id": 1,
      "assignment_id": 4,
      "project_name": "Project 200",
      "team_name": "The xmen200",
      "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
      "logo": null,
      "enrollment_key": "48402e524d3f43ae660669d7f1ec40f3",
      "unit_id": 1,
      "color": "#acb3d2",
      "pending_project_evaluation": false,
      "points": {
        "total": 0,
        "average": 0
      }
    },
    {
      "id": 2,
      "assignment_id": 4,
      "project_name": "Project 201",
      "team_name": "The xmen201",
      "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
      "logo": null,
      "enrollment_key": "a875f3676b49e1de7575f01a5b6137ba",
      "unit_id": 1,
      "color": "#d2b2ac",
      "pending_project_evaluation": false,
      "points": {
        "total": 0,
        "average": 0
      }
    },
    {
      "id": 3,
      "assignment_id": 4,
      "project_name": "Project 202",
      "team_name": "The xmen202",
      "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
      "logo": null,
      "enrollment_key": "74703e33d37ee26965900cbe4fa480e3",
      "unit_id": 1,
      "color": "#d2baac",
      "pending_project_evaluation": false,
      "points": {
        "total": 0,
        "average": 0
      }
    }
  ]
}

Returns all the Projects for the provided unit_id. Contains the 'team_points' and the 'team_average'. If the field 'pending_project_evaluation' is true then the current user can submit a project evaluation for this project. If 'pending_project_evaluations' is true, the response also contains the 'current_iteration_id' which indicated the iteration that can be evaluated. Also contains the previous and current rank of the Project by calculating the total points of each project in the Assignment.

HTTP Request

GET http://example.com/v1/projects

Query Parameters

RequiredParameterTypeDesription
requiredunit_idIntegerReturn all Projects for a specific Unit

Errors

Error CodeMeaning
400Bad Request -- Invalid 'includes' parameter
401Unauthorized -- Authentication Failed

Get Projects

Request

GET /projects
{
  "compact": "true",
  "includes": "students,assignment,lecturer"
}

Response

Status: 200 -- OK
{
  "projects": [
    {
      "id": 2,
      "assignment_id": 1,
      "project_name": "Project 549",
      "team_name": "The xmen546",
      "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
      "logo": null,
      "enrollment_key": "05be9418eac312049798e1662148a439",
      "unit_id": 1,
      "color": "#acd2cf",
      "pending_project_evaluation": false,
      "points": {
        "total": 0,
        "average": 0,
        "personal": 0
      },
      "nickname": "wolverine84912",
      "assignment": {
        "id": 1
      },
      "students": [
        {
          "id": 2
        },
        {
          "id": 3
        },
        {
          "id": 4
        },
        {
          "id": 8
        }
      ],
      "lecturer": {
        "id": 1
      }
    },
    {
      "id": 4,
      "assignment_id": 2,
      "project_name": "Project 551",
      "team_name": "The xmen548",
      "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
      "logo": null,
      "enrollment_key": "32bf2ff24c27793beadfff7dd53e570d",
      "unit_id": 2,
      "color": "#c0d2ac",
      "pending_project_evaluation": false,
      "points": {
        "total": 0,
        "average": 0,
        "personal": 0
      },
      "nickname": "wolverine40735",
      "assignment": {
        "id": 2
      },
      "students": [
        {
          "id": 5
        },
        {
          "id": 6
        },
        {
          "id": 7
        },
        {
          "id": 8
        }
      ],
      "lecturer": {
        "id": 1
      }
    }
  ]
}

Request

GET /projects

Response

Status: 200 -- OK
{
  "projects": [
    {
      "id": 1,
      "assignment_id": 4,
      "project_name": "Project 200",
      "team_name": "The xmen200",
      "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
      "logo": null,
      "enrollment_key": "48402e524d3f43ae660669d7f1ec40f3",
      "unit_id": 1,
      "color": "#acb3d2",
      "pending_project_evaluation": false,
      "points": {
        "total": 0,
        "average": 0,
        "personal": 0
      },
      "nickname": "wolverine74588"
    },
    {
      "id": 12,
      "assignment_id": 1,
      "project_name": "Project 211",
      "team_name": "The xmen211",
      "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
      "logo": null,
      "enrollment_key": "d86cdd9b53142f84cb3edf72f08a454f",
      "unit_id": 2,
      "color": "#acd2cf",
      "pending_project_evaluation": false,
      "points": {
        "total": 0,
        "average": 0,
        "personal": 0
      },
      "nickname": "wolverine7385"
    }
  ]
}

Returns all the Projects of the Student. Includes the nickname of the Student in each Project. Contains the 'team_points' and the 'team_average'. If the field 'pending_project_evaluation' is true then the current user can submit a project evaluation for this project. If 'pending_project_evaluations' is true, the response also contains the 'current_iteration_id' which indicated the iteration that can be evaluated. Also contains the previous and current rank of the Project by calculating the total points of each project in the Assignment.

HTTP Request

GET http://example.com/v1/projects

Query Parameters

RequiredParameterTypeDesription
requiredassignment_idIntegerReturn all Projects for a specific assignment

Errors

Error CodeMeaning
400Bad Request -- Invalid 'includes' parameter
401Unauthorized -- Authentication Failed
403Forbidden -- Parameters contained assignment_id. This is only allowed for Lecturers

Get Single Project

Example: Get a Project with its Students

Request

GET /projects/1?includes=students
{
  "includes": "students",
  "id": "2"
}

Response

Status: 200 -- OK
{
  "project": {
    "id": 2,
    "assignment_id": 1,
    "project_name": "Project 544",
    "team_name": "The xmen541",
    "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
    "logo": null,
    "enrollment_key": "efd1857009dc474bb4eb65e8342c7634",
    "unit_id": 1,
    "color": "#d0acd2",
    "pending_project_evaluation": false,
    "points": {
      "total": 0,
      "average": 0
    },
    "students": [
      {
        "id": 2,
        "first_name": "Jonathan504",
        "last_name": "Burgerhuman613",
        "email": "jonathan97324burgerhuman38032@gmail.com",
        "type": "Student",
        "provider": "test",
        "avatar_url": "http://i.pravatar.cc/100",
        "nickname": "wolverine88307"
      },
      {
        "id": 3,
        "first_name": "Jonathan423",
        "last_name": "Burgerhuman88",
        "email": "jonathan54353burgerhuman53560@gmail.com",
        "type": "Student",
        "provider": "test",
        "avatar_url": "http://i.pravatar.cc/100",
        "nickname": "wolverine864"
      },
      {
        "id": 4,
        "first_name": "Jonathan762",
        "last_name": "Burgerhuman742",
        "email": "jonathan6382burgerhuman99674@gmail.com",
        "type": "Student",
        "provider": "test",
        "avatar_url": "http://i.pravatar.cc/100",
        "nickname": "wolverine885"
      }
    ]
  }
}

Returns a single project. Requires the project's ID. Contains the 'team_points' and the 'team_average'. If the field 'pending_project_evaluation' is true then the current user can submit a project evaluation for this project.

HTTP Request

GET http://example.com/v1/projects/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Project to be returned

Errors

Error CodeMeaning
400Bad Request -- Invalid 'includes' parameter
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not associated with this resource

Get Single Project

Example: Get a Project with its Students, Assignment, Lecturer

Request

GET /projects/1?includes=students
{
  "includes": "students",
  "id": "2"
}

Response

Status: 200 -- OK
{
  "project": {
    "id": 2,
    "assignment_id": 1,
    "project_name": "Project 549",
    "team_name": "The xmen546",
    "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
    "logo": null,
    "enrollment_key": "05be9418eac312049798e1662148a439",
    "unit_id": 1,
    "color": "#acd2cf",
    "pending_project_evaluation": false,
    "points": {
      "total": 0,
      "average": 0,
      "personal": 0
    },
    "nickname": "wolverine84912",
    "students": [
      {
        "id": 2,
        "first_name": "Jonathan875",
        "last_name": "Burgerhuman937",
        "email": "jonathan87148burgerhuman40820@gmail.com",
        "type": "Student",
        "provider": "test",
        "avatar_url": "http://i.pravatar.cc/100",
        "nickname": "wolverine39414"
      },
      {
        "id": 3,
        "first_name": "Jonathan660",
        "last_name": "Burgerhuman721",
        "email": "jonathan51358burgerhuman352@gmail.com",
        "type": "Student",
        "provider": "test",
        "avatar_url": "http://i.pravatar.cc/100",
        "nickname": "wolverine1925"
      },
      {
        "id": 4,
        "first_name": "Jonathan869",
        "last_name": "Burgerhuman625",
        "email": "jonathan95690burgerhuman39196@gmail.com",
        "type": "Student",
        "provider": "test",
        "avatar_url": "http://i.pravatar.cc/100",
        "nickname": "wolverine9044"
      },
      {
        "id": 8,
        "first_name": "Jonathan227",
        "last_name": "Burgerhuman441",
        "email": "jonathan37581burgerhuman9868@gmail.com",
        "type": "Student",
        "provider": "email",
        "avatar_url": "http://i.pravatar.cc/100",
        "nickname": "wolverine84912"
      }
    ]
  }
}

Returns a single project. Requires the project's ID. Also includes the nickname of the Student for this project. Contains the 'team_points' and the 'team_average'. If the field 'pending_project_evaluation' is true then the current user can submit a project evaluation for this project.

HTTP Request

GET http://example.com/v1/projects/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Project to be returned

Errors

Error CodeMeaning
400Bad Request -- Invalid 'includes' parameter
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not associated with this resource

Create Project

Request

POST /projects
{
  "assignment_id": "1",
  "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
  "enrollment_key": "714f6d9220b2c8fc77eeffa24f11ca83",
  "logo": "",
  "project_name": "Project 217",
  "team_name": "The xmen217",
  "unit_id": ""
}

Response

Status: 201 -- Created
{
  "project": {
    "id": 17,
    "assignment_id": 1,
    "project_name": "Project 217",
    "team_name": "The xmen217",
    "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
    "logo": "",
    "enrollment_key": "714f6d9220b2c8fc77eeffa24f11ca83",
    "unit_id": 2,
    "color": "#d2acc0",
    "pending_project_evaluation": false,
    "points": {
      "total": 0,
      "average": 0
    }
  }
}

Request (Error)

POST /projects
{
  "assignment_id": "23",
  "color": "#d2adac",
  "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
  "enrollment_key": "59c0bf4c9cfd3af8e09d2831d8e38d28",
  "logo": "",
  "project_name": "Project 218",
  "team_name": "The xmen218",
  "unit_id": ""
}

Response

Status: 403 -- Forbidden
{
  "errors": {
    "base": [
      "This Assignment is not associated with the current user"
    ]
  }
}

The Lecturer creates a new Project. The project_name has to be provided, while the team_name will be autogenerated. Students can edit the team_name and the logo of the project.

HTTP Request

POST http://example.com/v1/projects

Query Parameters

RequiredParameterTypeDesription
requiredassignment_idIntegerThe assignment that the project belongs to
requiredproject_nameStringThe name of the project
descriptionStringA short description of the Project
team_nameStringThe name of the team of students in this project. Autogenerated if not provided.
enrollment_keyStringThe key used by the Students in order to enrol in the project. Autogenerated if not provided.
logoStringThe image logo of the Project.

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- The current user is not associated with this resource
422Unprocessable Entity -- Invalid Params. See response body for more info.

Update Project

Request

PATCH /projects/1
{
  "enrollment_key": "new_key",
  "id": "1"
}

Response

Status: 200 -- OK
{
  "project": {
    "id": 1,
    "assignment_id": 4,
    "project_name": "Project 200",
    "team_name": "The xmen200",
    "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
    "logo": null,
    "enrollment_key": "new_key",
    "unit_id": 1,
    "color": "#acb3d2",
    "pending_project_evaluation": false,
    "points": {
      "total": 0,
      "average": 0
    }
  }
}

Update a Project.

HTTP Request

PATCH http://example.com/v1/projects/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Project
project_nameStringThe name of the project
descriptionStringA short description of the Project
team_nameStringThe name of the team of students in this project.
enrollment_keyStringThe key used by the Students in order to enrol in the project.
logoStringThe image logo of the Project.

Errors

Error CodeMeaning
400Bad Request -- No parameters were provided besides an id
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not associated with this resource
422Unprocessable Entity -- Invalid Params. See response body for more info.

Update Project

Request

PATCH /projects/1
{
  "logo": "http://www.images.com/images/4259",
  "id": "1"
}

Response

Status: 200 -- OK
{
  "project": {
    "id": 1,
    "assignment_id": 4,
    "project_name": "Project 200",
    "team_name": "The xmen200",
    "description": "Lorem ipsum dolor sit amet, pri in erant detracto antiopam, duis altera nostrud id eam. Feugait invenire ut vim, novum reprimique reformidans id vis, sit at quis hinc liberavisse. Eam ex sint elaboraret assueverit, sed an equidem reformidans, idque doming ut quo. Ex aperiri labores has, dolorem indoctum hendrerit has cu. At case posidonium pri.",
    "logo": "http://www.images.com/images/4259",
    "enrollment_key": "48402e524d3f43ae660669d7f1ec40f3",
    "unit_id": 1,
    "color": "#acb3d2",
    "pending_project_evaluation": false,
    "points": {
      "total": 0,
      "average": 0,
      "personal": 0
    }
  }
}

Request (Error)

PATCH /projects/1
{
  "project_name": "whatever",
  "id": "1"
}

Response

Status: 400 -- Bad Request
{
  "errors": {
    "base": [
      "none of the given parameters can be updated by the current user"
    ]
  }
}

Update a Project. Students can only update team_name and logo.

HTTP Request

PATCH http://example.com/v1/projects/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Project
team_nameStringThe name of the team of students in this project.
logoStringThe image logo of the Project.

Errors

Error CodeMeaning
400Bad Request -- No parameters could found that could be update by a Student. Students can only update team_name and logo.
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not associated with this resource
422Unprocessable Entity -- Invalid Params. See response body for more info.

Delete Project

Delete a Project. Only the Lecturer that created it may do so.

HTTP Request

DELETE http://example.com/v1/projects/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Project to be deleted.

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- The current user is not associated with this resource
422Unprocessable Entity -- Invalid Params. See response body for more info.

Remove Student from Project

Request

DELETE /projects/3/remove_student?student_id=80
{
  "student_id": "58",
  "id": "10"
}

Response

Status: 204 -- No Content
{
  ""
}

Remove a Student from a Project. Used in cases of error, when a Student has enrolled in the 'wrong' project. The Lecturer has the ability to remove them from a Project, in order for the Student to select a different one.

HTTP Request

DELETE http://example.com/v1/projects/:id/remove_student

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the project that the Student should be removed from
requiredstudent_idIntegerThe id of the Student that needs to be removed from the Project

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- The current user is not associated with this resource
422Unprocessable Entity -- The student_id does not belong to any Student in the provided Project

Give Extension

Request

POST /projects/1/extensions
{
  "extra_time": "172800",
  "pa_form_id": "1",
  "project_id": "3"
}

Response

Status: 201 -- Created
{
  "id": 1,
  "project_id": 3,
  "deliverable_id": 1,
  "created_at": "2017-05-05T22:42:13.165Z",
  "updated_at": "2017-05-05T22:42:13.165Z",
  "extra_time": 172800
}

The Lecturer may choose to give an extension to give an Extension to the submission of the PA Form for a Project, extending its deadline. The Lecturer has to provide the project_id of the project that will receive the extension, as well as the pa_form_id of the particular form that will have its deadline extended.

HTTP Request

POST http://example.com/v1/projects/:project_id/extensions

Query Parameters

RequiredParameterTypeDesription
requiredproject_idIntegerThe id of the Project that will receive the extension
requiredpa_form_idIntegerThe id of the PAForm that will have its deadline extended
requiredextra_timeIntegerThe time that will be added to the extension of the form. In Unix Time.

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- Either the Project, or PAForm is not associated the the Lecturer
422Unprocessable Entity -- Invalid Params. See response body for more info.

Update Extension Time

Request

PATCH /projects/1/extensions/2
{
  "extra_time": "259200",
  "id": "2",
  "project_id": "3"
}

Response

Status: 200 -- OK
{
  "id": 2,
  "extra_time": 259200,
  "deliverable_id": 3,
  "project_id": 3,
  "created_at": "2017-05-05T22:42:13.273Z",
  "updated_at": "2017-05-05T22:42:13.281Z"
}

Request (Error)

PATCH /projects/1/extensions/2
{
  "extra_time": "259200",
  "id": "3",
  "project_id": "14"
}

Response

Status: 403 -- Forbidden
{
  "errors": {
    "base": [
      "This Extension is not associated with the current user"
    ]
  }
}

Update the extra_time of an already given extension.

HTTP Request

PATCH http://example.com/v1/projects/:project_id/extensions/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the extension that will be updated
requiredextra_timeIntegerThe time that will be added to the extension of the form. Must be an Integer. In Unix Time.

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- Either the Project, or PAForm is not associated the the Lecturer
422Unprocessable Entity -- Invalid Params. See response body for more info.

Revoke Extension

Request

DELETE /projects/1/extensions/2
{
  "id": "4",
  "project_id": "3"
}

Response

Status: 204 -- No Content
{
  ""
}

Revoke an already given extension

HTTP Request

DELETE http://example.com/v1/projects/:project_id/extensions/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the extension that will be destroyd
requiredextra_timeIntegerThe time that will be added to the extension of the form. Must be an Integer. In Unix Time.

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- Either the Project, or PAForm is not associated the the Lecturer
422Unprocessable Entity -- Invalid Params. See response body for more info.

Update Nickname in Project

Request

PATCH /projects/12/update_nickname
{
  "nickname": "giorgakis",
  "id": "1"
}

Response

Status: 200 -- OK
{
  "nickname": "giorgakis"
}

Update the Student's nicname in a specific project.

HTTP Request

PATCH http://example.com/v1/projects/:id/update_nickname

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Project that the Student wishes to change their nickname for
requirednicknameStringThe new nickname for this Project

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Student. This endpoint is only available to Students.
403Forbidden -- The Student does not belong in this Project
422Unprocessable Entity -- Nickname was not provided or it was invalid. See response body for info

Project Evaluations

‘Students and Lecturers evaluate the Project’s progress

Twice per iteration, Students and Lecturers must evaluate the Progress of the Project. The can give their opinion on two aspects of the Project, the perceived percentage of completion and how they feel about the Project. This data will be used to calculate statistics, and give the Lecturer a better viewpoint on the progress of a Project.

Attributes

Parameter Type Description
user_id Integer The id of the User (Student or Lecturer) making the evaluation
project_id Integer The id of the Project that is evaluated
iteration_id Integer The id of the Iteration, for which the Project is evaluated
date_submitted Date The date that the evaluation was submitted. Autocompleted by the server.
percent_complete Integer A number from 0 to 100 that shows the perceived percentage of completion of the Project

Relationships

Project Evaluation Relationships

Get Pending Project Evaluations

Request

GET /project-evaluations

Response

Status: 200 -- OK
{
  "pending_evaluations": [
    {
      "project_id": 3,
      "iteration_id": 1,
      "team_answers": [

      ]
    },
    {
      "project_id": 2,
      "iteration_id": 1,
      "team_answers": [

      ]
    },
    {
      "project_id": 1,
      "iteration_id": 1,
      "team_answers": [
        {
          "user": {
            "id": 38,
            "first_name": "Jonathan205",
            "last_name": "Burgerhuman749",
            "email": "jonathan17167burgerhuman64702@gmail.com",
            "type": "Student",
            "provider": "test",
            "avatar_url": "http://i.pravatar.cc/100"
          },
          "percent_completed": null
        }
      ]
    }
  ]
}

Request

GET /project-evaluations

Response

Status: 204 -- No Content
{
  ""
}

Get Pending Project Evaluation for the current_user at the current time. Contains the project_id, the iteration_id and the answers that the students have given, if any of them have submitted the Project Evalution.

HTTP Request

GET http://example.com/v1/project-evaluations

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed

Get Pending Project Evaluations

Request

GET /project-evaluations

Response

Status: 200 -- OK
{
  "pending_evaluations": [
    {
      "project_id": 1,
      "iteration_id": 1
    }
  ]
}

Request

GET /project-evaluations

Response

Status: 204 -- No Content
{
  ""
}

Get Pending Project Evaluation for the current_user at the current time. Contains the project_id and the iteration_id.

HTTP Request

GET http://example.com/v1/project-evaluations

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed

Submit Project Evaluation

Request

POST /project_evaluations
{
  "feelings": [
    {
      "feeling_id": "2",
      "percent": "32"
    },
    {
      "feeling_id": "3",
      "percent": "64"
    }
  ],
  "iteration_id": "1",
  "percent_complete": "39",
  "user_id": "38",
  "project_id": "1"
}

Response

Status: 201 -- Created
{
  "project_evaluation": {
    "id": 1,
    "user_id": 38,
    "project_id": 1,
    "iteration_id": 1,
    "percent_complete": 39,
    "date_submitted": "2017-05-05T22:42:24.761Z"
  },
  "points": {
    "points_earned": 20,
    "new_total": 20,
    "detailed": {
      "project_evaluation": [
        {
          "points": 10,
          "reason_id": 2,
          "resource_id": 1
        },
        {
          "points": 10,
          "reason_id": 6,
          "resource_id": 1
        }
      ]
    }
  }
}

Request (Error)

POST /project_evaluations
{
  "date_submitted": "",
  "feelings_average": "-34",
  "iteration": "5",
  "iteration_id": "1",
  "percent_complete": "39",
  "project": "16",
  "user": "45",
  "user_id": "38",
  "project_id": "1"
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "feelings_average": [
      "can't be blank"
    ],
    "iteration_id": [
      "is not a currently active Iteration. Submission must be no later that the iteration's deadline."
    ]
  }
}

Submit a new Project Evaluation. Accepts an Array of hashes containg the percentage that each feeling represents the user submitting it. Feelings that the user has input 0% should not be submitted. After submission, a feeelings_average is calculated based on the percent that the user answered and the value (positive or negative) of the feeling.

HTTP Request

POST http://example.com/v1/projects/:project_id/evaluations

Query Parameters

RequiredParameterTypeDesription
requiredproject_idIntegerThe id of the Project that will be evaluated
requirediteration_idIntegerThe id of the Iteration, for which the Project is evaluated
requiredpercent_completeIntegerA number from 0 to 100 that shows the perceived percentage of completion of the Project
requiredfeelingsArrayInteger,percent=>IntegerAn array of feelings with the percentage that the user answered that they feel it.

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not associated with this resource
422Unprocessable Entity -- Invalid Params. See response body for more info.

Question Types

‘The currently available Question Types’

The Question Type indicates whether a question should be anwered as free text, a number, or any other type that might come to exist.

Attributes

Parameter Type Description
id Integer The id of the QuestionType. This is the ID that should be used in the questions.
category String The type of the question. Currently either 'text’, or 'number’
friendly_name String The name that should be displayed to the users indicating the type of answer that is needed

Get Question Types

Request

GET /question_types

Response

Status: 200 -- OK
{
  "question_types": [
    {
      "id": 1,
      "question_type": "text",
      "friendly_name": "name"
    },
    {
      "id": 2,
      "question_type": "text",
      "friendly_name": "name"
    },
    {
      "id": 3,
      "question_type": "text",
      "friendly_name": "name"
    }
  ]
}

Returns all the available QuestionTypes

HTTP Request

GET http://example.com/v1/question_types

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed

Get Previous Questions

Request

GET /questions

Response

Status: 200 -- OK
{
  "questions": [
    {
      "id": 1,
      "type_id": 1,
      "text": "Do you prefer Honey or Jam?",
      "question_type": {
        "id": 1,
        "question_type": "text",
        "friendly_name": "name"
      }
    },
    {
      "id": 2,
      "type_id": 2,
      "text": "Do you prefer Honey or Jam?",
      "question_type": {
        "id": 2,
        "question_type": "text",
        "friendly_name": "name"
      }
    },
    {
      "id": 3,
      "type_id": 3,
      "text": "Whats your favourite precious stone?",
      "question_type": {
        "id": 3,
        "question_type": "text",
        "friendly_name": "name"
      }
    },
    {
      "id": 4,
      "type_id": 4,
      "text": "If you were a fashion designer, what style of clothing or accessories would you design?",
      "question_type": {
        "id": 4,
        "question_type": "text",
        "friendly_name": "name"
      }
    },
    {
      "id": 5,
      "type_id": 5,
      "text": "Could you ever hand milk a cow?",
      "question_type": {
        "id": 5,
        "question_type": "text",
        "friendly_name": "name"
      }
    }
  ]
}

Returns all the unique, previously created Questions of the Lecturer. This can be used when a new PaForm is created, to allow the Lecturer to pick Questions that they frequently use and reuse them. The Questions are scoped to the current user, and a lecturer can only see their own Questions.

HTTP Request

GET http://example.com/v1/questions

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed

Units

‘Units contain assignments and projects’

Units are the first resource that a Lecturer must create before they can start using the system. Units contain Assignments contain Projects. However, due to the fact that the Assignement feature is mostly hidden from the User, most of the times it will appear like a Unit has many Projects. A Unit also belongs to Department. Units can be archived by the Lecturer after their projects have been completed, and will thus not appear on the GET /units request.

Attributes

Parameter Type Description
name string The name of the Unit.
code string The code that identifies the Unit. It doesn’t have to be unique
semester string The Semester that the Unit takes place. example: 'Autumn’ or 'Spring’
year Integer The year that the Unit takes place
lecturer_id Integer The id of the Lecturer that teaches teh Unit
department - name string The name of the Unit’s Department
department - university string The name of the Department’s University
archived_at date The date that the Unit was archived. Completed by the system upon archival.

Relationships

Unit Relationships

Create Unit

Example: Creating a new Department with the Unit

Request

POST /units
{
  "archived_at": "",
  "code": "w330I8ibVegdSQ==",
  "department_attributes": {
    "name": "departmentname",
    "university": "university"
  },
  "name": "Unit 637",
  "semester": "Spring",
  "year": "2015"
}

Response

Status: 201 -- Created
{
  "unit": {
    "id": 1,
    "name": "Unit 637",
    "code": "w330I8ibVegdSQ==",
    "semester": "Spring",
    "year": 2015,
    "archived_at": null,
    "department_id": 1,
    "department": {
      "id": 1,
      "university": "university",
      "name": "departmentname"
    }
  }
}

Example: Associating an existing Department with the Unit

Request

POST /units
{
  "archived_at": "",
  "code": "dluw6Mz+ny8oVA==",
  "department_id": "2",
  "name": "Unit 473",
  "semester": "Spring",
  "year": "2016"
}

Response

Status: 201 -- Created
{
  "unit": {
    "id": 2,
    "name": "Unit 473",
    "code": "dluw6Mz+ny8oVA==",
    "semester": "Spring",
    "year": 2016,
    "archived_at": null,
    "department_id": 2,
    "department": {
      "id": 2,
      "university": "University of 59688",
      "name": "Computer Science58611"
    }
  }
}

Request (Error)

POST /units
{
  "archived_at": "",
  "code": "lM4IMuwvfbV0Tw==",
  "department_attributes": {
    "name": "1"
  },
  "name": "Unit 231",
  "semester": "Autumn",
  "year": "2015"
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "department.university": [
      "can't be blank"
    ]
  }
}

Create a new Unit. A Unit belongs to a Department. If a department_id is supplied in the params, the unit will become associated with an existing Department. If department_attributes are present, then a new Department will be created and associated with the Unit. In case both department_id, and department_attributes are present, the department_id takes precedence, and the new Unit is associated with an existing Department.

HTTP Request

POST http://example.com/v1/units

Query Parameters

RequiredParameterTypeDesription
requirednameStringThe name of the Unit
requiredcodeStringThe code of the Unit. does not have to be unique
requiredsemesterStringThe Semester that the Unit takes place. example: 'Autumn' or 'Spring'
requiredyearIntegerThe year that the Unit takes place
requireddepartment_attributes: { name }StringThe name of the Unit's Department
requireddepartment_attributes: { university }StringThe name of the Department's university
requireddepartment_idIntegerThe id of an existing Department that will be associated with the new Unit

In order to create a new Department with the Unit, use "department_attributes"

{ "name": "New Unit", "department_attributes": { "name": "New Department", "university": "University of .." } }

In order to associate an existing Department with the Unit, use "department_id"

{ "name": "New Unit", "department_id": 4 }

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- The current user is not associated with this resource
422Unprocessable Entity -- Invalid Params. See response body for more info.

Get Units

Request

GET /units

Response

Status: 200 -- OK
{
  "units": [
    {
      "id": 2,
      "name": "Unit 80",
      "code": "n0+7SYvvQybIrw==",
      "semester": "Autumn",
      "year": 2016,
      "archived_at": null,
      "department_id": 2,
      "department": {
        "id": 2,
        "university": "University of 275",
        "name": "Computer Science39454"
      }
    },
    {
      "id": 1,
      "name": "Unit 104",
      "code": "3QYv0hBiNWdNVw==",
      "semester": "Autumn",
      "year": 2015,
      "archived_at": null,
      "department_id": 1,
      "department": {
        "id": 1,
        "university": "University of 28417",
        "name": "Computer Science73919"
      }
    }
  ]
}

Returns all the NOT-ARCHIVED Units of the current User. For the archived Units, see get archived

HTTP Request

GET http://example.com/v1/units

Errors

Error CodeMeaning
400Bad Request -- Invalid 'includes' parameter
401Unauthorized -- Authentication Failed

Get Archived Units

Request

GET /units/archived

Response

Status: 200 -- OK
{
  "units": [
    {
      "id": 8,
      "name": "Unit 150",
      "code": "Ax2WvRejX1XlVA==",
      "semester": "Autumn",
      "year": 2017,
      "archived_at": "2017-05-06",
      "department_id": 8,
      "department": {
        "id": 8,
        "university": "University of 97832",
        "name": "Computer Science4670"
      }
    },
    {
      "id": 7,
      "name": "Unit 351",
      "code": "YxFls4ApJX26CQ==",
      "semester": "Spring",
      "year": 2016,
      "archived_at": "2017-05-06",
      "department_id": 7,
      "department": {
        "id": 7,
        "university": "University of 24480",
        "name": "Computer Science95057"
      }
    }
  ]
}

Request

GET /units/archived

Response

Status: 204 -- No Content
{
  ""
}

Returns all the ARCHIVED Units of the current User. For the active Units, see get index

HTTP Request

GET http://example.com/v1/units/archived

Errors

Error CodeMeaning
400Bad Request -- Invalid 'includes' parameter
401Unauthorized -- Authentication Failed

Get Single Unit

Request

GET /units/:id
{
  "id": "12"
}

Response

Status: 200 -- OK
{
  "unit": {
    "id": 12,
    "name": "Unit 87",
    "code": "5rKnG0jMqIeMZA==",
    "semester": "Autumn",
    "year": 2015,
    "archived_at": null,
    "department_id": 12,
    "department": {
      "id": 12,
      "university": "University of 71878",
      "name": "Computer Science3668"
    }
  }
}

Returns a single Unit

HTTP Request

GET http://example.com/v1/units/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Unit to be returned

Errors

Error CodeMeaning
400Bad Request -- Invalid 'includes' parameter
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not associated with this resource

Update Unit

Request

PATCH /units/:id
{
  "code": "different",
  "name": "different",
  "id": "19"
}

Response

Status: 200 -- OK
{
  "unit": {
    "id": 19,
    "name": "different",
    "code": "different",
    "semester": "Spring",
    "year": 2016,
    "archived_at": null,
    "department_id": 19,
    "department": {
      "id": 19,
      "university": "University of 96138",
      "name": "Computer Science38069"
    }
  }
}

Update a Unit. A Unit belongs to a Department. If a department_id is supplied in the params, the unit will become associated with an existing Department. If department_attributes are present, then a new Department will be created and associated with the Unit. In case both department_id, and department_attributes are present, the department_id takes precedence, and the new Unit is associated with an existing Department.

HTTP Request

PATCH http://example.com/v1/units/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Unit to be updated
nameStringThe name of the Unit
codeStringThe code of the Unit. does not have to be unique
semesterStringThe Semester that the Unit takes place. example: 'Autumn' or 'Spring'
yearIntegerThe year that the Unit takes place
department_attributes: { name }StringThe name of the Unit's Department
department_attributes: { university }StringThe name of the Department's university
department_idIntegerThe id of an existing Department that will be associated with the new Unit

In order to create a new Department with the Unit, use "department_attributes"

{ "name": "New Unit", "department_attributes": { "name": "New Department", "university": "University of .." } }

In order to associate an existing Department with the Unit, use "department_id"

{ "name": "New Unit", "department_id": 4 }

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- The current user is not associated with this resource
422Unprocessable Entity -- Invalid Params. See response body for more info.

Delete Unit

Delete a Unit. Only the Lecturer that created it may do so.

HTTP Request

DELETE http://example.com/v1/units/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Unit to be deleted.

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- The current user is not associated with this resource
422Unprocessable Entity -- Invalid Params. See response body for more info.

Archive Unit

Request

PATCH /units/:id/archive
{
  "id": "29"
}

Response

Status: 200 -- OK
{
  "unit": {
    "id": 29,
    "name": "Unit 493",
    "code": "hv2rTfNptbWiig==",
    "semester": "Spring",
    "year": 2014,
    "archived_at": "2017-05-06",
    "department_id": 32,
    "department": {
      "id": 32,
      "university": "University of 52972",
      "name": "Computer Science47954"
    }
  }
}

Request (Error)

PATCH /units/:id/archive
{
  "id": "31"
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "unit": [
      "has already been archived. It cannot be archived twice."
    ]
  }
}

Archive a Unit. Only the Lecturer that created it may do so. The server will set the current date as the archived_at date. The Unit will no longer be returns at the GET /units endpoint, use the GET /units/archived instead.

HTTP Request

PATCH http://example.com/v1/units/:id/archive

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the Unit to be archived.

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The current user is not a Lecturer. This endpoint is only available to Lecturers.
403Forbidden -- The current user is not associated with this resource
422Unprocessable Entity -- Invalid Params. See response body for more info.

Users

‘Students and Lecturers’

A User can be either a Student or a Lecturer. The /users endpoint is used to handle account creation, and account updates. It also contais the functionality of reseting one’s password, and confirming the account.

Attributes

Parameter Type Description
first_name string The first name of the User
last_name string The last Name of the User
password string The User’s password
type String Either 'Student’ or 'Lecturer’

Relationships

Unit Relationships

Create Account

Request

POST /users
{
  "email": "alfredo47884_jump63118@gmail.com",
  "first_name": "Alfredo775",
  "last_name": "Jumpveryhigh290",
  "password": "12345678",
  "password_confirmation": "12345678",
  "position": "Master of Parking",
  "provider": "email",
  "type": "Lecturer",
  "university": "University of Important Potato"
}

Response

Status: 201 -- Created
{
  "user": {
    "id": 1,
    "first_name": "Alfredo775",
    "last_name": "Jumpveryhigh290",
    "email": "alfredo47884_jump63118@gmail.com",
    "type": "Lecturer",
    "provider": "email",
    "avatar_url": "http://i.pravatar.cc/100",
    "position": "Master of Parking",
    "university": "University of Important Potato"
  }
}

Request (Error)

POST /users
{
  "user": {
    "email": "email@email.com",
    "password": "12345678",
    "password_confirmation": "12345678",
    "type": "Lecturer"
  }
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "type": [
      "must be either Student or Lecturer. Received: "
    ]
  }
}

Request (Error)

POST /users
{
  "email": "emailemail.com",
  "first_name": "Rixardos",
  "last_name": "Arlekinos",
  "password": "12345678",
  "password_confirmation": "12345678",
  "type": "Lecturer"
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "email": [
      "is invalid"
    ],
    "position": [
      "can't be blank"
    ],
    "university": [
      "can't be blank"
    ]
  }
}

Request (Error)

POST /users
{
  "email": "email@email.com",
  "first_name": "Rixardos",
  "last_name": "Arlekinos",
  "password": "asdfasdf",
  "password_confirmation": "12345678",
  "type": "Lecturer"
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "password_confirmation": [
      "doesn't match Password"
    ],
    "position": [
      "can't be blank"
    ],
    "university": [
      "can't be blank"
    ]
  }
}

Request (Error)

POST /users
{
  "email": "emailmail.com",
  "last_name": "Arlekinos",
  "password": "1234",
  "password_confirmation": "1234",
  "type": "Lecturer"
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "email": [
      "is invalid"
    ],
    "password": [
      "is too short (minimum is 8 characters)"
    ],
    "first_name": [
      "can't be blank"
    ],
    "position": [
      "can't be blank"
    ],
    "university": [
      "can't be blank"
    ]
  }
}

Register a new User resource, of type Lecturer, that is authenticatable with email and password.

HTTP Request

POST http://example.com/v1/users

Query Parameters

RequiredParameterTypeDesription
requiredemailStringA Unique email
requiredpasswordStringMinimum 8 characters. Requires password_confirmation to be present in the params
requiredpassword_confirmationStringMust equal password. Required password to be present in the params
requiredfirst_namestringThe first name of the User
requiredlast_namestringThe last name of the User
requireduniversityStringThe Lecturer's university
requiredpositionStringThe Lecturer's academic position in the university
requiredtypeStringShould be 'Lecturer'. Note the capital 'L' at the beginning of the work.

Errors

Error CodeMeaning
422Unprocessable Entity -- Invalid Params. See response body for more info.

Create Account

Request

POST /users
{
  "email": "email@email.com",
  "first_name": "Jonathan13",
  "last_name": "Burgerhuman232",
  "password": "12345678",
  "password_confirmation": "12345678",
  "type": "Student"
}

Response

Status: 201 -- Created
{
  "user": {
    "id": 1,
    "first_name": "Jonathan13",
    "last_name": "Burgerhuman232",
    "email": "email@email.com",
    "type": "Student",
    "provider": "email",
    "avatar_url": "http://i.pravatar.cc/100"
  }
}

Request (Error)

POST /users
{
  "user": {
    "email": "email@email.com",
    "password": "12345678",
    "password_confirmation": "12345678",
    "type": "Student"
  }
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "type": [
      "must be either Student or Lecturer. Received: "
    ]
  }
}

Request (Error)

POST /users
{
  "email": "emailemail.com",
  "first_name": "Rixardos",
  "last_name": "Arlekinos",
  "password": "12345678",
  "password_confirmation": "12345678",
  "type": "Student"
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "email": [
      "is invalid"
    ]
  }
}

Request (Error)

POST /users
{
  "email": "emailemail.com",
  "first_name": "Rixardos",
  "last_name": "Arlekinos",
  "password": "12345678",
  "password_confirmation": "12345678",
  "type": "Student"
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "email": [
      "is invalid"
    ]
  }
}

Request (Error)

POST /users
{
  "email": "email@email.com",
  "first_name": "Rixardos",
  "last_name": "Arlekinos",
  "password": "asdfasdf",
  "password_confirmation": "12345678",
  "type": "Student"
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "password_confirmation": [
      "doesn't match Password"
    ]
  }
}

Request (Error)

POST /users
{
  "email": "email@email.com",
  "first_name": "Jonathan323",
  "last_name": "Burgerhuman591",
  "password": "12345678",
  "password_confirmation": "12345678"
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "type": [
      "must be either Student or Lecturer. Received: "
    ]
  }
}

Register a new User resource, of type Student, that is authenticatable with email and password.

HTTP Request

POST http://example.com/v1/users

Query Parameters

RequiredParameterTypeDesription
requiredemailStringThe User's email
requiredpasswordStringMinimum 8 characters. Requires password_confirmation to be present in the params
requiredpassword_confirmationStringMust equal password. Requires password to be present in the params
requiredfirst_namestringThe first name of the User
requiredlast_namestringThe last name of the User
requiredtypeStringShould be 'Student'. Note the capital 'S' at the beginning of the work.

Errors

Error CodeMeaning
422Unprocessable Entity -- Invalid Params. See response body for more info.

Update Account

Request

PATCH /users/1
{
  "first_name": "different",
  "id": "1"
}

Response

Status: 200 -- OK
{
  "user": {
    "id": 1,
    "first_name": "different",
    "last_name": "Jumpveryhigh507",
    "email": "alfredo75851_jump46341@gmail.com",
    "type": "Lecturer",
    "provider": "email",
    "avatar_url": "http://i.pravatar.cc/100",
    "position": "Master of Parking",
    "university": "University of Important Potato"
  }
}

Request

PATCH /users/1
{
  "current_password": "12345678",
  "password": "qwertyuiop",
  "password_confirmation": "qwertyuiop",
  "id": "4"
}

Response

Status: 200 -- OK
{
  "user": {
    "id": 4,
    "first_name": "Alfredo492",
    "last_name": "Jumpveryhigh211",
    "email": "alfredo40737_jump7551@gmail.com",
    "type": "Lecturer",
    "provider": "email",
    "avatar_url": "http://i.pravatar.cc/100",
    "position": "Master of Parking",
    "university": "University of Important Potato"
  }
}

Request (Error)

PATCH /users/1
{
  "first_name": "change_their_name",
  "id": "9"
}

Response

Status: 403 -- Forbidden
{
  "errors": {
    "user": [
      "User with id 9 is not authorized to access this resourse."
    ]
  }
}

Request (Error)

PATCH /users/1
{
  "current_password": "wrong_password",
  "password": "qwertyuiop",
  "password_confirmation": "qwertyuiop",
  "id": "12"
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "current_password": [
      "is invalid"
    ]
  }
}

Register a new User resource, of type Student, that is authenticatable with email and password.

HTTP Request

PATCH http://example.com/v1/users/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the User to be updated. It should be the current user.
emailStringA Unique Email
Required only if password will be updatedcurrent_passwordStringThe current password of the user.
passwordStringMinimum 8 characters. Requires current_password and password_confirmation to be present in the params
password_confirmationStringMust equal password. Requires password and current_password to be present in the params.
first_namestringThe first name of the User
last_namestringThe last name of the User
universityStringThe Lecturer's university
positionStringThe Lecturer's academic position in the university
typeStringShould be 'Student'. Note the capital 'S' at the beginning of the work.

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The User to be updated is not the authenticated user. One can only update themselves
422Unprocessable Entity -- Invalid Params. See response body for more info.

Update Account

Request

PATCH /users/1
{
  "first_name": "different",
  "id": "1"
}

Response

Status: 200 -- OK
{
  "user": {
    "id": 1,
    "first_name": "different",
    "last_name": "Burgerhuman929",
    "email": "jonathan54360burgerhuman77887@gmail.com",
    "type": "Student",
    "provider": "email",
    "avatar_url": "http://i.pravatar.cc/100"
  }
}

Request

PATCH /users/1
{
  "current_password": "12345678",
  "password": "qwertyuiop",
  "password_confirmation": "qwertyuiop",
  "id": "4"
}

Response

Status: 200 -- OK
{
  "user": {
    "id": 4,
    "first_name": "Jonathan36",
    "last_name": "Burgerhuman585",
    "email": "jonathan65040burgerhuman62225@gmail.com",
    "type": "Student",
    "provider": "email",
    "avatar_url": "http://i.pravatar.cc/100"
  }
}

Request (Error)

PATCH /users/1
{
  "first_name": "change_their_name",
  "id": "9"
}

Response

Status: 403 -- Forbidden
{
  "errors": {
    "user": [
      "User with id 9 is not authorized to access this resourse."
    ]
  }
}

Request (Error)

PATCH /users/1
{
  "current_password": "wrong_password",
  "password": "qwertyuiop",
  "password_confirmation": "qwertyuiop",
  "id": "12"
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "current_password": [
      "is invalid"
    ]
  }
}

Register a new User resource, of type Student, that is authenticatable with email and password.

HTTP Request

PATCH http://example.com/v1/users/:id

Query Parameters

RequiredParameterTypeDesription
requiredidIntegerThe id of the User to be updated. It should be the current user.
emailStringA Unique Email
Required only if password will be updatedcurrent_passwordStringThe current password of the user.
passwordStringMinimum 8 characters. Requires current_password and password_confirmation to be present in the params
password_confirmationStringMust equal password. Requires password and current_password to be present in the params.
first_namestringThe first name of the User
last_namestringThe last name of the User
typeStringShould be 'Student'. Note the capital 'S' at the beginning of the work.

Errors

Error CodeMeaning
401Unauthorized -- Authentication Failed
403Forbidden -- The User to be updated is not the authenticated user. One can only update themselves
422Unprocessable Entity -- Invalid Params. See response body for more info.

Confirm Account

Request (Error)

GET /confirm_account
{
  "confirmation_token": "5tEPbsePzzzvDG4mJjGw"
}

Response

Status: 302 -- 
<html><body>You are being <a href="http://test.host/user_confirmation_success.html">redirected</a>.</body></html>

Request (Error)

GET /confirm_account
{
  "confirmation_token": "H9nzFJAY9sQsVG7Kcj7kdljkafdjklfdakjldfsaldfas"
}

Response

Status: 302 -- 
<html><body>You are being <a href="http://test.host/user_confirmation_failure.html">redirected</a>.</body></html>

Accept Confirmation. The link contained in the email sent to the user points to this route. It redirects to a 'success' or 'failure' page to inform the user. Evaluates the confirmation token contained within the params and confirms or rejects the user. If this fails, assure that the link sent to the user contains the confirmation token in the url, and offer the user the option to resend the confirmation email through the POST /confirmation endpoint.

HTTP Request

GET http://capstoneed-api.org:21992/v1/confirm_account?confirmation_token=Lai67Y226RNxPZquBnVy

Query Parameters

RequiredParameterTypeDesription
requiredconfirmation_tokenStringThe confirmation token is contained as a parameter in the link that is sent to the user to confirm their account

Resend Confirmation Email

Request

POST /resend_confirmation_email
{
  "email": "alfredo36229_jump76340@gmail.com"
}

Response

Status: 204 -- No Content
{
  ""
}

Request (Error)

POST /resend_confirmation_email
{
  "email": "alfredo61667_jump22955@gmail.com"
}

Response

Status: 422 -- Unprocessable Entity
{
  "errors": {
    "email": [
      "was already confirmed, please try signing in"
    ]
  }
}

Resends a confirmation email to the email provided in the params. The email must be a valid email in the system.

HTTP Request

POST http://example.com/v1/resend_confirmation_email

Query Parameters

RequiredParameterTypeDesription
requiredemailStringThe user's email. The confirmation email will be sent to this email

Errors

Error CodeMeaning
422Unprocessable Entity -- Invalid Params. See response body for more info.