Overview
Welcome to the CircuitVerse API! You can use our API to access CircuitVerse API endpoints, which can get information on various public projects, user projects, groups you mentor, pending assignments and a whole bunch of stuff.
Client Errors
HTTP/1.1 400 Bad Request
{
"errors": [
{
"status": 400,
"title": "invalid parameters",
"detail": "invalid parameters"
}
]
}
HTTP/1.1 422 Unprocessable Entity
{
"errors": [
{
"status": 422,
"title": "resource invalid!",
"detail": "resource invalid!"
}
]
}
HTTP/1.1 401 Unauthorized
{
"errors": [
{
"status": 401,
"title": "not authenticated",
"detail": "not authenticated"
}
]
}
HTTP/1.1 403 Forbidden
{
"errors": [
{
"status": 403,
"title": "not authorized",
"detail": "not authorized"
}
]
}
HTTP/1.1 500 Internal Server Error
{
"errors": [
{
"status": 500,
"title": "Something Unexpectedly Went Wrong! Please consider opening a github issue :)",
"detail": "Something Unexpectedly Went Wrong! Please consider opening a github issue :)"
}
]
}
Error Code | Meaning |
---|---|
400 | Bad Request -- Your request is invalid. |
401 | Unauthorized -- Your Authentication token is wrong. |
403 | Forbidden -- The resource requested is hidden for requested user only. |
404 | Not Found -- The resource requested could not be found. |
405 | Method Not Allowed -- You tried to access a resource with an invalid method. |
409 | Conflict -- The request could not be processed due to a conflict. |
429 | Too Many Requests -- You're requesting too many resources! Slow down! |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |
Authorization
CircuitVerse API uses RSASSA
cryptographic signing that requires private
and associated public
key
GET /api/v1/users/1 HTTP/1.1
Accept: application/json
Host: localhost
Authorization: Token eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjp7InVzZXJfaWQiOjIsInVzZXJuYW1lIjoiTml0aXNoIEFnZ2Fyd2FsIiwiZW1haWwiOiJyb3lhbG5pdGlzaDIxQGdtYWlsLmNvbSJ9LCJleHAiOjE1ODkyMDI5ODF9.tHRLJeQGuLiJ1Ncc2tQSaNiQnbrnERKuOPERfZeNnF8
You can authenticate in the API by providing the user's token
in the Authorization
header.
Pagination
GET /api/v1/resource?page[number]=2 HTTP/1.1
Accept: application/json
Host: localhost
Requests that return multiple items will be paginated to 5 items by default.
You can specify further pages with the ?page[number]
parameter. For some resources, you can also set a custom page size with the ?page[size]
parameter.
Links
GET /api/v1/resources HTTP/1.1
Accept: application/json
Host: localhost
HTTP/1.1 200 OK
{
"resources": [],
"links": {
"self": "http://localhost:3000/api/v1/resource?page[number]=1",
"first": "http://localhost:3000/api/v1/resource?page[number]=1",
"prev": null,
"next": "http://localhost:3000/api/v1/resource?page[number]=2",
"last": "http://localhost:3000/api/v1/resource?page[number]=4"
}
}
In each GET request that acts upon resources, there is an extra field in the response under "links" root element. It includes, the links to current requested page, next page, previous page, first page and the last page for resources under the given params.
Cross Origin Resource Sharing
The API supports Cross Origin Resource Sharing (CORS) for requests from any origin.
Authentication
In order to make requests that require the user to be authenticated, you must retrieve the token to be able to act on the behalf of the user.
Sign Up a User
This endpoint gives back the authentication token that encodes user's id
, name
and email
.
Possible exceptions
Error Code | Description |
---|---|
409 | When user already exists. |
422 | Invalid or missing parameters. |
POST /api/v1/auth/signup HTTP/1.1
Accept: application/json
Host: localhost
{
"email": "[email protected]",
"password": "12345678",
"name": "Test Name"
}
HTTP/1.1 201 CREATED
Content-Type: application/json
JSON response example:
{
"token": "eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjp7InVzZXJfaWQiOjIsInVzZXJuYW1lIjoiTml0aXNoIEFnZ2Fyd2FsIiwiZW1haWwiOiJyb3lhbG5pdGlzaDIxQGdtYWlsLmNvbSJ9LCJleHAiOjE1ODkyMDI5ODF9.tHRLJeQGuLiJ1Ncc2tQSaNiQnbrnERKuOPERfZeNnF8"
}
Login a User
This endpoint gives back the authentication token that encodes user's id
, name
and email
.
Possible exceptions
Error Code | Description |
---|---|
401 | Invalid password. |
404 | Non existent user tries to login. |
POST /api/v1/auth/login HTTP/1.1
Accept: application/json
Host: localhost
{
"email": "[email protected]",
"password": "12345678"
}
HTTP/1.1 202 ACCEPTED
Content-Type: application/json
JSON response example:
{
"token": "eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjp7InVzZXJfaWQiOjIsInVzZXJuYW1lIjoiTml0aXNoIEFnZ2Fyd2FsIiwiZW1haWwiOiJyb3lhbG5pdGlzaDIxQGdtYWlsLmNvbSJ9LCJleHAiOjE1ODkyMDI5ODF9.tHRLJeQGuLiJ1Ncc2tQSaNiQnbrnERKuOPERfZeNnF8"
}
Reset Password Instructions
This endpoint sends an email to the user with specified email
in POST params with instructions to reset his/her password.
Possible exceptions
Error Code | Description |
---|---|
404 | User associated with given email does not exists |
POST /api/v1/password/forgot HTTP/1.1
Accept: application/json
Host: localhost
{
"email": "[email protected]"
}
HTTP/1.1 200 OK
Content-Type: application/json
JSON response example:
{
"message": "password reset instructions sent to [email protected]"
}
GET Public Key
This endpoint GETs you the public_key.pem
required to decode the token to fetch authenticated user's id
, name
& email
.
POST /api/v1/public_key.pem HTTP/1.1
Host: localhost
HTTP/1.1 200 OK
Content-Type: application/json
TEXT response example:
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3D8j5djbLuNcEwWEEU4v
Y38gIpaZrDvnec2DyRwzt+pvMuFPcrfnjAkVBTeYwiGdhH3eNSm3juJZHH506x3I
mKuQp7vo6Ni+vZVsYyA5kVuj+Qv4bR3DjFh/Hd4O2dcXfcsFgjnM7sUv6Oxa3tDi
9869O4BQNnddiOjMj2S+9NJePMWjItBMA7LwYq1n3NVQbW4m3tSb5h/V/PpVspgV
rF0ZO4xczXjGzhsapkFdibfIuac6BH74xyUwlizmu8GStap2VnFlSYiIoAEtfBp9
HKl1z24Yoa4Wu+Li9wVrKYueMjbxVicvNeOxvMEVD5/xI0o1z0rT7srzkr1TCdCd
6QIDAQAB
-----END PUBLIC KEY-----
Users
Get All Users
You can GET all users in /api/v1/users
. Authentication token
is passed through Authorization
header and is required.
URL Parameters
Parameter | Description |
---|---|
page[number] |
The number th page of the response |
page[size] |
The size of the per_page response |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
GET /api/v1/users HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 200 OK
JSON response example:
{
"data": [
{
"id": "1",
"type": "users",
"attributes": {
"name": "Test User 1"
}
},
{
"id": "2",
"type": "users",
"attributes": {
"name": "Test User 2"
}
},
{
"id": "3",
"type": "users",
"attributes": {
"name": "Test User 3"
}
},
{
"id": "4",
"type": "users",
"attributes": {
"name": "Test User 4"
}
},
{
"id": "5",
"type": "users",
"attributes": {
"name": "Test User 5"
}
}
],
"links": {
"self": "http://localhost:3000/api/v1/users?page[number]=1",
"first": "http://localhost:3000/api/v1/users?page[number]=1",
"prev": null,
"next": "http://localhost:3000/api/v1/users?page[number]=2",
"last": "http://localhost:3000/api/v1/users?page[number]=4"
}
}
GET logged in User
You can GET the logged in user details in /api/v1/me
. Authentication token
is passed through Authorization
header and is required.
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
GET /api/v1/users/1 HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 200 OK
JSON response example:
{
"data": {
"id": "1",
"type": "user",
"attributes": {
"id": 1,
"email": "[email protected]",
"name": "Test User 1",
"admin": false,
"country": null,
"educational_institute": null,
"subscribed": true,
"created_at": "2020-03-22T12:41:28.931Z",
"updated_at": "2020-03-22T12:41:29.803Z"
}
}
}
GET a Specific User
You can GET particular user details in /api/v1/users/{:id}
. Authentication token
is passed through Authorization
header and is required.
URL Parameters
Parameter | Description |
---|---|
id |
The id of the user to retrieve |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
404 | When the requested user identified by id does not exists. |
GET /api/v1/users/1 HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 200 OK
JSON response example:
{
"data": {
"id": "1",
"type": "user",
"attributes": {
"id": 1,
"email": "[email protected]",
"name": "Test User 1",
"admin": false,
"country": null,
"educational_institute": null,
"subscribed": true,
"created_at": "2020-03-22T12:41:28.931Z",
"updated_at": "2020-03-22T12:41:29.803Z"
}
}
}
UPDATE a Specific User
You can UPDATE a specific user details in /api/v1/users/{:id}
. Authentication token
is passed through Authorization
header and is required.
URL Parameters
Parameter | Description |
---|---|
id |
The id of the user to update |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
403 | When the user identified by id differs from authenticated user |
404 | When the user identified by id does not exists. |
PATCH /api/v1/users/1 HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
{
"name": "Test User 1 updated"
}
HTTP/1.1 202 ACCEPTED
JSON response example:
{
"data": {
"id": "1",
"type": "user",
"attributes": {
"id": 1,
"email": "[email protected]",
"name": "Test User 1 updated",
"admin": false,
"country": null,
"educational_institute": null,
"subscribed": true,
"created_at": "2020-03-22T12:41:28.931Z",
"updated_at": "2020-03-22T12:41:29.803Z"
}
}
}
Projects
GET All Projects
You can GET all projects in /api/v1/projects
. Authentication token
is passed through Authorization
header and is optional.
This endpoint fetches all the public projects
if the user is not authorized. If authorized it fetches all the projects user has access to including private projects
.
URL Query Parameters
Parameter | Description |
---|---|
page[number] |
The number th page of the response |
page[size] |
The size of the per_page response |
filter[tag] |
The projects to be filtered by tag |
sort |
, separated String of sortable params |
include |
Adds passed params details in included section of response |
Possible exceptions
Error Code | Description |
---|---|
401 | When user tries to authenticate with invalid or corrupt token . |
GET /api/v1/projects?include=author HTTP/1.1
Accept: application/json
Authorization: Token {token} // optional
Host: localhost
HTTP/1.1 200 OK
JSON response example:
{
"data": [
{
"id": "1",
"type": "project",
"attributes": {
"name": "Simple LED",
"project_access_type": "Public",
"created_at": "2020-05-10T13:04:15.649Z",
"updated_at": "2020-05-10T13:04:15.649Z",
"image_preview": {
"url": "/img/default.png"
},
"description": " <p>Hey there, Loving CircuitVerse</p>",
"view": 1,
"tags": [],
"stars_count": 0
},
"relationships": {
"author": {
"data": {
"id": "1",
"type": "author"
}
}
}
},
{
"id": "2",
"type": "project",
"attributes": {
"name": "Test 1",
"project_access_type": "Public",
"created_at": "2020-03-21T18:59:50.380Z",
"updated_at": "2020-03-21T18:59:54.500Z",
"image_preview": {
"url": "/uploads/project/image_preview/11/default.png"
},
"description": "",
"view": 1,
"tags": [],
"stars_count": 0
},
"relationships": {
"author": {
"data": {
"id": "1",
"type": "author"
}
}
}
},
{
"id": "3",
"type": "project",
"attributes": {
"name": "Test 3",
"project_access_type": "Public",
"created_at": "2020-05-10T13:07:44.960Z",
"updated_at": "2020-05-10T13:07:44.960Z",
"image_preview": {
"url": "/img/default.png"
},
"description": " <p>Hey there, Loving Circuitverse</p>",
"view": 1,
"tags": [],
"stars_count": 0
},
"relationships": {
"author": {
"data": {
"id": "1",
"type": "author"
}
}
}
},
{
"id": "4",
"type": "project",
"attributes": {
"name": "Test 4",
"project_access_type": "Public",
"created_at": "2020-03-21T18:55:54.528Z",
"updated_at": "2020-03-28T04:51:21.479Z",
"image_preview": {
"url": "/uploads/project/image_preview/10/preview_2020-03-22_00_25_54_%2B0530.jpeg"
},
"description": "",
"view": 2,
"tags": [],
"stars_count": 1
},
"relationships": {
"author": {
"data": {
"id": "1",
"type": "author"
}
}
}
},
{
"id": "5",
"type": "project",
"attributes": {
"name": "Test 5",
"project_access_type": "Public",
"created_at": "2020-05-10T13:10:18.349Z",
"updated_at": "2020-05-10T13:10:18.349Z",
"image_preview": {
"url": "/uploads/project/image_preview/18/preview_2020-03-19_09_46_53_%2B0530.jpeg"
},
"description": " <p>Hey there, Loving Circuitverse</p>",
"view": 1,
"tags": [],
"stars_count": 0
},
"relationships": {
"author": {
"data": {
"id": "1",
"type": "author"
}
}
}
}
],
"included": [
{
"id": "1",
"type": "author",
"attributes": {
"name": "Test User",
"email": "[email protected]"
}
}
],
"links": {
"self": "http://localhost:3000/api/v1/projects?page[number]=1",
"first": "http://localhost:3000/api/v1/projects?page[number]=1",
"prev": null,
"next": "http://localhost:3000/api/v1/projects?page[number]=2",
"last": "http://localhost:3000/api/v1/projects?page[number]=4"
}
}
GET User Specific Projects
You can GET all users specific (identified by :id
) projects in /api/v1/users/:id/projects
. Authentication token
is passed through Authorization
header and is required.
This endpoint fetches user specific public projects
if the user is not authorized as the user identified by :id
. If authorized as the user identified by :id
it fetches all the user specific projects including private projects
.
URL Parameters
Parameter | Description |
---|---|
id |
The id to identify the user |
URL Query Parameters
Parameter | Description |
---|---|
page[number] |
The number th page of the response |
page[size] |
The size of the per_page response |
filter[tag] |
The projects to be filtered by tag |
sort |
, separated String of sortable params |
include |
Adds passed params details in included section of response |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token |
404 | When user associated with :id does not exists |
GET /api/v1/users/:id/projects?include=author HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 200 OK
JSON response example:
{
"data": [
{
"id": "1",
"type": "project",
"attributes": {
"name": "Test User/Test",
"project_access_type": "Private",
"created_at": "2020-03-28T04:14:34.683Z",
"updated_at": "2020-05-18T16:53:07.349Z",
"image_preview": {
"url": "/img/default.png"
},
"description": null,
"view": 11,
"tags": [],
"stars_count": 1
},
"relationships": {
"author": {
"data": {
"id": "1",
"type": "author"
}
}
}
},
{
"id": "2",
"type": "project",
"attributes": {
"name": "Test 3",
"project_access_type": "Public",
"created_at": "2020-03-21T18:55:54.528Z",
"updated_at": "2020-03-28T04:51:21.479Z",
"image_preview": {
"url": "/uploads/project/image_preview/10/preview_2020-03-22_00_25_54_%2B0530.jpeg"
},
"description": "",
"view": 2,
"tags": [],
"stars_count": 1
},
"relationships": {
"author": {
"data": {
"id": "1",
"type": "author"
}
}
}
},
{
"id": "3",
"type": "project",
"attributes": {
"name": "Simple LED",
"project_access_type": "Public",
"created_at": "2020-05-10T13:04:15.649Z",
"updated_at": "2020-05-10T13:04:15.649Z",
"image_preview": {
"url": "/img/default.png"
},
"description": " <p>Hey there, Loving Circuitverse</p>",
"view": 1,
"tags": [],
"stars_count": 0
},
"relationships": {
"author": {
"data": {
"id": "1",
"type": "author"
}
}
}
},
{
"id": "4",
"type": "project",
"attributes": {
"name": "Test 5",
"project_access_type": "Public",
"created_at": "2020-03-21T18:59:50.380Z",
"updated_at": "2020-03-21T18:59:54.500Z",
"image_preview": {
"url": "/uploads/project/image_preview/11/default.png"
},
"description": "",
"view": 1,
"tags": [],
"stars_count": 0
},
"relationships": {
"author": {
"data": {
"id": "1",
"type": "author"
}
}
}
},
{
"id": "5",
"type": "project",
"attributes": {
"name": "Simple LED",
"project_access_type": "Public",
"created_at": "2020-05-10T13:07:44.960Z",
"updated_at": "2020-05-10T13:07:44.960Z",
"image_preview": {
"url": "/img/default.png"
},
"description": " <p>Hey there, Loving Circuitverse</p>",
"view": 1,
"tags": [],
"stars_count": 0
},
"relationships": {
"author": {
"data": {
"id": "1",
"type": "author"
}
}
}
}
],
"included": [
{
"id": "1",
"type": "author",
"attributes": {
"name": "Test User",
"email": "[email protected]"
}
}
],
"links": {
"self": "http://localhost:3000/api/v1/users/1/projects?page[number]=1",
"first": "http://localhost:3000/api/v1/users/1/projects?page[number]=1",
"prev": null,
"next": "http://localhost:3000/api/v1/users/1/projects?page[number]=2",
"last": "http://localhost:3000/api/v1/users/1/projects?page[number]=3"
}
}
GET Project Details
You can GET project details (identified by :id
) in /api/v1/projects/:id/
. Authentication token
is passed through Authorization
header and is required.
URL Parameters
Parameter | Description |
---|---|
id |
The id of the project to be detailed |
include |
Adds passed params details in included section of response |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
403 | When Project is private or authenticated user doesn't have access to |
404 | When the requested project identified by id does not exists. |
GET /api/v1/projects/:id?include=author HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 200 OK
JSON response example:
{
"data": {
"id": "1",
"type": "project",
"attributes": {
"name": "Simple LED",
"project_access_type": "Public",
"created_at": "2020-03-19T04:16:53.543Z",
"updated_at": "2020-05-10T13:18:13.814Z",
"image_preview": {
"url": "/uploads/project/image_preview/9/preview_2020-03-19_09_46_53_%2B0530.jpeg"
},
"description": " <p>Hey there, Loving Circuitverse</p>",
"view": 2,
"tags": [
{
"id": 1,
"name": "CV",
"created_at": "2020-03-10T13:02:10.381Z",
"updated_at": "2020-03-10T13:02:10.381Z"
}
],
"stars_count": 1
},
"relationships": {
"author": {
"data": {
"id": "1",
"type": "author"
}
}
}
},
"included": [
{
"id": "1",
"type": "author",
"attributes": {
"name": "Test User",
"email": "[email protected]"
}
}
]
}
UPDATE Project
You can UPDATE project details (identified by :id
) in /api/v1/projects/:id/
. Authentication token
is passed through Authorization
header and is required.
List of acceptable params for put/patch requests include:
Name | Type | Description |
---|---|---|
name |
String |
Updated name of the project |
project_access_type |
String |
Public or Private |
description |
String |
Updated description of the project |
tag_list |
String |
Comma separated String of tags |
URL Parameters
Parameter | Description |
---|---|
id |
The id of the project to be detailed |
include |
Adds passed params details in included section of response |
Possible exceptions
Error Code | Description |
---|---|
400 | When invalid parameters are used. |
401 | When user is not authenticated i.e invalid or corrupt token . |
403 | When Project author differs from authenticated user |
404 | When the requested project identified by id does not exists. |
PATCH /api/v1/projects/:id?include=author HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
{
"project": {
"name": "Simple LED Updated"
// other params here too
}
}
HTTP/1.1 202 ACCEPTED
Content-Type: application/json
JSON response example:
{
"data": {
"id": "1",
"type": "project",
"attributes": {
"name": "Simple LED Updated",
"project_access_type": "Public",
"created_at": "2020-03-19T04:16:53.543Z",
"updated_at": "2020-05-10T13:18:13.814Z",
"image_preview": {
"url": "/uploads/project/image_preview/9/preview_2020-03-19_09_46_53_%2B0530.jpeg"
},
"description": " <p>Hey there, Loving Circuitverse</p>",
"view": 2,
"tags": [
{
"id": 1,
"name": "CV",
"created_at": "2020-03-10T13:02:10.381Z",
"updated_at": "2020-03-10T13:02:10.381Z"
}
],
"stars_count": 1
},
"relationships": {
"author": {
"data": {
"id": "1",
"type": "author"
}
}
}
},
"included": [
{
"id": "1",
"type": "author",
"attributes": {
"name": "Test User",
"email": "[email protected]"
}
}
]
}
DELETE Project
You can DELETE project (identified by :id
) in /api/v1/projects/:id/
. Authentication token
is passed through Authorization
header and is required.
URL Parameters
Parameter | Description |
---|---|
id |
The id of the project to be deleted |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
403 | When Project author differs from authenticated user |
404 | When the requested project identified by id does not exists. |
DELETE /api/v1/projects/:id HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 204 NO CONTENT
Content-Type: application/json
GET Featured Projects
You can GET all featured projects in /api/v1/projects/featured
. Authentication token
is passed through Authorization
header and is required.
URL Query Parameters
Parameter | Description |
---|---|
page[number] |
The number th page of the response |
page[size] |
The size of the per_page response |
filter[tag] |
The projects to be filtered by tag |
sort |
, separated String of sortable params |
include |
Adds passed params details in included section of response |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
GET /api/v1/projects/featured?include=author HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 200 OK
JSON response example:
{
"data": [
{
"id": "1",
"type": "project",
"attributes": {
"name": "Simple LED",
"project_access_type": "Public",
"created_at": "2020-03-19T04:16:53.543Z",
"updated_at": "2020-05-10T13:18:13.814Z",
"image_preview": {
"url": "/uploads/project/image_preview/9/preview_2020-03-19_09_46_53_%2B0530.jpeg"
},
"description": " <p>Hey there, Loving Circuitverse</p>",
"view": 2,
"tags": [
{
"id": 1,
"name": "CV",
"created_at": "2020-03-10T13:02:10.381Z",
"updated_at": "2020-03-10T13:02:10.381Z"
}
],
"stars_count": 1
},
"relationships": {
"author": {
"data": {
"id": "1",
"type": "author"
}
}
}
}
],
"included": [
{
"id": "1",
"type": "author",
"attributes": {
"name": "Test User",
"email": "[email protected]"
}
}
],
"links": {
"self": "http://localhost:3000/api/v1/projects/featured?page[number]=1",
"first": "http://localhost:3000/api/v1/projects/featured?page[number]=1",
"prev": null,
"next": null,
"last": "http://localhost:3000/api/v1/projects/featured?page[number]=1"
}
}
STAR/UNSTAR a Project
You can star or unstar a project in /api/v1/projects/:id/toggle-star
. Authentication token
is passed through Authorization
header and is required.
URL Parameters
Parameter | Description |
---|---|
id |
The id of the project to be starred |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
404 | When the requested project identified by id does not exists. |
GET /api/v1/projects/:id/toggle-star HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 200 OK
Content-Type: application/json
{
"message": "Starred/Unstarred successfully!"
}
FORK a Project
You can FORK a project (identified by :id
) in /api/v1/projects/:id/fork
. Authentication token
is passed through Authorization
header and is required.
URL Parameters
Parameter | Description |
---|---|
id |
The id of the project to be detailed |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
409 | When user tries ot fork his/her own project |
404 | When the requested project identified by id does not exists. |
POST /api/v1/projects/:id/fork HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 200 OK
JSON response example:
{
"data": {
"id": "2",
"type": "project",
"attributes": {
"name": "Test User/Simple LED",
"project_access_type": "Public",
"created_at": "2020-03-19T04:16:53.543Z",
"updated_at": "2020-05-10T13:18:13.814Z",
"image_preview": {
"url": "/uploads/project/image_preview/9/preview_2020-03-19_09_46_53_%2B0530.jpeg"
},
"description": " <p>Hey there, Loving Circuitverse</p>",
"view": 2,
"tags": [
{
"id": 1,
"name": "CV",
"created_at": "2020-03-10T13:02:10.381Z",
"updated_at": "2020-03-10T13:02:10.381Z"
}
],
"stars_count": 1
},
"relationships": {
"author": {
"data": {
"id": "1",
"type": "author"
}
}
}
}
}
Collaborators
GET All project collaborators
You can GET all collaborators for a particular project in /api/v1/projects/:project_id/collaborators
. Authentication token
is passed through Authorization
header and is required.
URL Query Parameters
Parameter | Description |
---|---|
page[number] |
The number th page of the response |
page[size] |
The size of the per_page response |
Possible exceptions
Error Code | Description |
---|---|
401 | When user tries to authenticate with invalid or corrupt token . |
GET /api/v1/projects/:project_id/collaborators HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 200 OK
JSON response example
{
"data": [
{
"id": "1",
"type": "user",
"attributes": {
"name": "Collaborator's Name"
}
}
],
"links": {
"self": "http://localhost:3000/api/v1/projects/1/collaborators?page[number]=1",
"first": "http://localhost:3000/api/v1/projects/1/collaborators?page[number]=1",
"prev": null,
"next": null,
"last": "http://localhost:3000/api/v1/projects/1/collaborators?page[number]=1"
}
}
CREATE/ADD Collaborator
Project author can add collaborators to his/her project in /api/v1/projects/:project_id/collaborators
. Authentication token
is passed through Authorization
header and is required.
URL Parameters
Parameter | Description |
---|---|
project_id |
The id of the project, collaborators are to be added |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
403 | When non-author user tries to add collaborators to the project |
404 | When the requested project identified by project_id does not exists. |
POST /api/v1/projects/:project_id/collaborators HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
{
"emails": "[email protected], [email protected], NA"
}
HTTP/1.1 200 OK
JSON response example:
{
"added": ["[email protected]"],
"existing": ["[email protected]"],
"invalid": ["NA"]
}
DELETE Collaborator
Project author can DELETE a collaborator (identified by :id
) in /api/v1/projects/:project_id/collaborators/:id
. Authentication token
is passed through Authorization
header and is required.
URL Parameters
Parameter | Description |
---|---|
project_id |
The id of the project, collaborators are to be deleted of |
id |
The id of the collaborating member |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
403 | When non-author user tries to delete the collaborator |
404 | When the requested project identified by project_id does not exists. |
404 | When the requested collaborator identified by id does not exists. |
DELETE /api/v1/projects/:project_id/collaborators/:id HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 204 NO CONTENT
Content-Type: application/json
Groups
GET All your groups
You can GET all groups you are a member of in /api/v1/groups
. Authentication token
is passed through Authorization
header and is required.
URL Query Parameters
Parameter | Description |
---|---|
page[number] |
The number th page of the response |
page[size] |
The size of the per_page response |
include |
Adds passed params details in included |
Possible exceptions
Error Code | Description |
---|---|
401 | When user tries to authenticate with invalid or corrupt token . |
404 | When user has no groups associated with him/her. |
GET /api/v1/groups?include=group_members,assignments HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 200 OK
JSON response example (including
group_members
&assignments
):
{
"data": [
{
"id": "1",
"type": "group",
"attributes": {
"member_count": 1,
"mentor_name": "Test Mentor",
"name": "Test Group 1",
"mentor_id": 1,
"created_at": "2020-02-25T18:15:39.825Z",
"updated_at": "2020-02-25T18:15:39.825Z"
},
"relationships": {
"group_members": {
"data": [
{
"id": "1",
"type": "group_member"
}
]
},
"assignments": {
"data": [
{
"id": "1",
"type": "assignment"
}
]
}
}
},
{
"id": "2",
"type": "group",
"attributes": {
"member_count": 1,
"mentor_name": "Test Mentor",
"name": "Test Group 2",
"mentor_id": 1,
"created_at": "2020-02-27T11:08:54.886Z",
"updated_at": "2020-02-27T11:08:54.886Z"
},
"relationships": {
"group_members": {
"data": [
{
"id": "2",
"type": "group_member"
},
{
"id": "3",
"type": "group_member"
}
]
},
"assignments": {
"data": []
}
}
},
{
"id": "3",
"type": "group",
"attributes": {
"member_count": 1,
"mentor_name": "Test Mentor",
"name": "Test Group 3",
"mentor_id": 1,
"created_at": "2020-03-13T15:14:53.948Z",
"updated_at": "2020-03-13T15:14:53.948Z"
},
"relationships": {
"group_members": {
"data": [
{
"id": "4",
"type": "group_member"
}
]
},
"assignments": {
"data": []
}
}
},
{
"id": "4",
"type": "group",
"attributes": {
"member_count": 1,
"mentor_name": "Test Mentor",
"name": "Test Group 4",
"mentor_id": 4,
"created_at": "2020-03-22T12:42:04.511Z",
"updated_at": "2020-03-22T12:42:04.511Z"
},
"relationships": {
"group_members": {
"data": [
{
"id": "5",
"type": "group_member"
}
]
},
"assignments": {
"data": [
{
"id": "2",
"type": "assignment"
}
]
}
}
}
],
"included": [
{
"id": "1",
"type": "assignment",
"attributes": {
"name": "Test assignment 1",
"deadline": "2021-05-24T11:47:40.244Z",
"description": "test description",
"created_at": "2020-05-24T11:47:40.244Z",
"updated_at": "2020-05-24T11:47:40.244Z",
"status": "open",
"has_mentor_access": true,
"current_user_project_id": null,
"grading_scale": "no_scale",
"grades_finalized": false,
"restrictions": "[]"
}
},
{
"id": "2",
"type": "assignment",
"attributes": {
"name": "Test assignment 2",
"deadline": "2021-05-24T11:48:26.739Z",
"description": "test description",
"created_at": "2020-05-24T11:48:26.740Z",
"updated_at": "2020-05-24T11:48:26.740Z",
"status": "open",
"has_mentor_access": true,
"current_user_project_id": null,
"grading_scale": "no_scale",
"grades_finalized": false,
"restrictions": "[]"
}
},
{
"id": "1",
"type": "group_member",
"attributes": {
"group_id": 1,
"user_id": 1,
"created_at": "2020-02-25T18:15:52.890Z",
"updated_at": "2020-02-25T18:15:52.890Z",
"name": "Test User 1",
"email": "[email protected]"
}
},
{
"id": "2",
"type": "group_member",
"attributes": {
"group_id": 2,
"user_id": 2,
"created_at": "2020-02-25T18:15:52.890Z",
"updated_at": "2020-02-25T18:15:52.890Z",
"name": "Test User 2",
"email": "[email protected]"
}
},
{
"id": "3",
"type": "group_member",
"attributes": {
"group_id": 2,
"user_id": 3,
"created_at": "2020-02-25T18:15:52.890Z",
"updated_at": "2020-02-25T18:15:52.890Z",
"name": "Test User 3",
"email": "[email protected]"
}
},
{
"id": "4",
"type": "group_member",
"attributes": {
"group_id": 3,
"user_id": 4,
"created_at": "2020-02-25T18:15:52.890Z",
"updated_at": "2020-02-25T18:15:52.890Z",
"name": "Test User 4",
"email": "[email protected]"
}
},
{
"id": "5",
"type": "group_member",
"attributes": {
"group_id": 4,
"user_id": 5,
"created_at": "2020-02-25T18:15:52.890Z",
"updated_at": "2020-02-25T18:15:52.890Z",
"name": "Test User 5",
"email": "[email protected]"
}
}
],
"links": {
"self": "http://localhost:3000/api/v1/groups?page[number]=1",
"first": "http://localhost:3000/api/v1/groups?page[number]=1",
"prev": null,
"next": null,
"last": "http://localhost:3000/api/v1/groups?page[number]=1"
}
}
GET All mentored groups
You can GET all groups you mentor in /api/v1/groups/mentored
. Authentication token
is passed through Authorization
header and is required.
URL Query Parameters
Parameter | Description |
---|---|
page[number] |
The number th page of the response |
page[size] |
The size of the per_page response |
include |
Adds passed params details in included |
Possible exceptions
Error Code | Description |
---|---|
401 | When user tries to authenticate with invalid or corrupt token . |
404 | When user has no groups associated with him/her. |
GET /api/v1/groups/mentored?include=group_members,assignments HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 200 OK
JSON response will be similiar as above
GET Group Details
You can GET group details (identified by :id
) in /api/v1/groups/:id/
. Authentication token
is passed through Authorization
header and is required.
URL Parameters
Parameter | Description |
---|---|
id |
The id of the project to be detailed |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
403 | When authenticated user is neither mentor nor user of the Group |
404 | When the requested group identified by id does not exists. |
GET /api/v1/groups/:id?include=group_members,assignments HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 200 OK
JSON response example:
{
"data": {
"id": "1",
"type": "group",
"attributes": {
"member_count": 1,
"mentor_name": "Test Mentor",
"name": "Test Group 1",
"mentor_id": 1,
"created_at": "2020-02-25T18:15:39.825Z",
"updated_at": "2020-02-25T18:15:39.825Z"
},
"relationships": {
"group_members": {
"data": [
{
"id": "1",
"type": "group_member"
}
]
},
"assignments": {
"data": [
{
"id": "1",
"type": "assignment"
}
]
}
}
},
"included": [
{
"id": "1",
"type": "assignment",
"attributes": {
"name": "Test assignment 1",
"deadline": "2021-05-24T11:47:40.244Z",
"description": "test description",
"created_at": "2020-05-24T11:47:40.244Z",
"updated_at": "2020-05-24T11:47:40.244Z",
"status": "open",
"has_mentor_access": true,
"current_user_project_id": null,
"grading_scale": "no_scale",
"grades_finalized": false,
"restrictions": "[]"
}
},
{
"id": "1",
"type": "group_member",
"attributes": {
"group_id": 1,
"user_id": 1,
"created_at": "2020-02-25T18:15:52.890Z",
"updated_at": "2020-02-25T18:15:52.890Z",
"name": "Test User 1",
"email": "[email protected]"
}
}
]
}
UPDATE Group
You can UPDATE group details (identified by :id
) in /api/v1/groups/:id/
. Authentication token
is passed through Authorization
header and is required.
List of acceptable params for put/patch requests include:
Name | Type | Description |
---|---|---|
name |
String |
Updated name of the group |
mentor_id |
String |
Mentor identified by id |
URL Parameters
Parameter | Description |
---|---|
id |
The id of the group to be updated |
Possible exceptions
Error Code | Description |
---|---|
400 | When invalid parameters are used. |
401 | When user is not authenticated i.e invalid or corrupt token . |
403 | When non-mentor user tries to update the group |
404 | When the requested group identified by id does not exists. |
PATCH /api/v1/groups/:id HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
{
"group": {
"name": "Group Name Updated"
// other params here too
}
}
HTTP/1.1 202 ACCEPTED
Content-Type: application/json
JSON response example:
{
"data": {
"id": "1",
"type": "group",
"attributes": {
"member_count": 1,
"mentor_name": "Test Mentor",
"name": "Group Name Updated",
"mentor_id": 1,
"created_at": "2020-02-25T18:15:39.825Z",
"updated_at": "2020-02-25T18:15:39.825Z"
},
"relationships": {
"group_members": {
"data": [
{
"id": "1",
"type": "group_member"
}
]
},
"assignments": {
"data": [
{
"id": "1",
"type": "assignment"
}
]
}
}
},
"included": [
{
"id": "1",
"type": "assignment",
"attributes": {
"name": "Test assignment 1",
"deadline": "2021-05-24T11:47:40.244Z",
"description": "test description",
"created_at": "2020-05-24T11:47:40.244Z",
"updated_at": "2020-05-24T11:47:40.244Z",
"status": "open",
"has_mentor_access": true,
"current_user_project_id": null,
"grading_scale": "no_scale",
"grades_finalized": false,
"restrictions": "[]"
}
},
{
"id": "1",
"type": "group_member",
"attributes": {
"group_id": 1,
"user_id": 1,
"created_at": "2020-02-25T18:15:52.890Z",
"updated_at": "2020-02-25T18:15:52.890Z",
"name": "Test User 1",
"email": "[email protected]"
}
}
]
}
DELETE Group
Group mentor can DELETE a group (identified by :id
) in /api/v1/groups/:id/
. Authentication token
is passed through Authorization
header and is required.
URL Parameters
Parameter | Description |
---|---|
id |
The id of the group to be deleted |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
403 | When non-mentor user tries to update the group |
404 | When the requested group identified by id does not exists. |
DELETE /api/v1/groups/:id HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 204 NO CONTENT
Content-Type: application/json
Group Members
GET All group members
You can GET all group members for a particular group in /api/v1/groups/:group_id/members
. Authentication token
is passed through Authorization
header and is required.
URL Query Parameters
Parameter | Description |
---|---|
page[number] |
The number th page of the response |
page[size] |
The size of the per_page response |
Possible exceptions
Error Code | Description |
---|---|
401 | When user tries to authenticate with invalid or corrupt token . |
404 | When group has no groups members associated with it. |
GET /api/v1/groups/:group_id/members HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 200 OK
JSON response example
{
"data": [
{
"id": "1",
"type": "group_member",
"attributes": {
"group_id": 1,
"user_id": 1,
"created_at": "2020-02-25T18:15:52.890Z",
"updated_at": "2020-02-25T18:15:52.890Z",
"name": "Test User 1",
"email": "[email protected]"
}
}
],
"links": {
"self": "http://localhost:3000/api/v1/groups/1/group_members?page[number]=1",
"first": "http://localhost:3000/api/v1/groups/1/group_members?page[number]=1",
"prev": null,
"next": null,
"last": "http://localhost:3000/api/v1/groups/1/group_members?page[number]=1"
}
}
CREATE/ADD Group Member
You can add members to your group in /api/v1/groups/:group_id/members
. Authentication token
is passed through Authorization
header and is required.
URL Parameters
Parameter | Description |
---|---|
group_id |
The id of the group, members are to be fetched |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
403 | When non-mentor user tries to add members to the group |
404 | When the requested group identified by group_id does not exists. |
POST /api/v1/groups/:group_id/members HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
{
"emails": "[email protected], [email protected], NA"
}
HTTP/1.1 200 OK
JSON response example:
{
"added": ["[email protected]"],
"pending": ["[email protected]"],
"invalid": ["NA"]
}
DELETE Group Member
Group mentor can DELETE a group member (identified by :id
) in /api/v1/group/members/:id/
. Authentication token
is passed through Authorization
header and is required.
URL Parameters
Parameter | Description |
---|---|
id |
The id of the group member to be deleted |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
403 | When non-mentor user tries to delete the group member |
404 | When the requested group member identified by id does not exists. |
DELETE /api/v1/group/members/:id HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 204 NO CONTENT
Content-Type: application/json
Assignments
GET Group's Assignments
You can GET all the assignments for the group you have access to in /api/v1/groups/:group_id/assignments
. Authentication token
is passed through Authorization
header and is required.
URL Query Parameters
Parameter | Description |
---|---|
page[number] |
The number th page of the response |
page[size] |
The size of the per_page response |
include |
Adds passed params details in included |
Possible exceptions
Error Code | Description |
---|---|
401 | When user tries to authenticate with invalid or corrupt token . |
403 | When user without show access tries to fetch assignments |
404 | When the group identified by :group_id does not exist |
GET /api/v1/groups/:group_id/assignments?include=grades,projects HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 200 OK
JSON response example :
{
"data": [
{
"id": "1",
"type": "assignment",
"attributes": {
"name": "Test assignment 1",
"deadline": "2021-05-24T11:47:40.244Z",
"description": "assignment description",
"created_at": "2020-05-24T11:47:40.244Z",
"updated_at": "2020-05-24T11:47:40.244Z",
"status": "open",
"restrictions": "[\"Input\",\"ConstantVal\",\"Splitter\",\"Random\"]",
"has_mentor_access": true,
"current_user_project_id": null,
"grading_scale": "no_scale",
"grades_finalized": false
},
"relationships": {
"projects": {
"data": [
{
"id": "1",
"type": "project"
}
]
},
"grades": {
"data": [
{
"id": "1",
"type": "grade"
}
]
}
}
},
{
"id": "2",
"type": "assignment",
"attributes": {
"name": "Test assignment 2",
"deadline": "2021-05-24T11:47:40.244Z",
"description": "assignment description",
"created_at": "2020-05-24T11:47:40.244Z",
"updated_at": "2020-05-24T11:47:40.244Z",
"status": "open",
"restrictions": "[\"Input\",\"ConstantVal\",\"Splitter\",\"Random\"]",
"has_mentor_access": true,
"current_user_project_id": null,
"grading_scale": "no_scale",
"grades_finalized": false
},
"relationships": {
"projects": {
"data": [
{
"id": "2",
"type": "project"
}
]
},
"grades": {
"data": [
{
"id": "2",
"type": "grade"
}
]
}
}
}
],
"included": [
{
"id": "1",
"type": "grade",
"attributes": {
"grade": "A",
"remarks": null,
"created_at": "2020-06-25T13:37:51.049Z",
"updated_at": "2020-06-25T13:37:51.049Z"
},
"relationships": {
"project": {
"data": {
"id": "1",
"type": "project"
}
}
}
},
{
"id": "1",
"type": "project",
"attributes": {
"name": "Test User 1/Test Project 1",
"project_access_type": "Private",
"created_at": "2020-06-12T08:19:05.139Z",
"updated_at": "2020-06-12T08:19:05.139Z",
"image_preview": {
"url": "/img/default.png"
},
"description": null,
"view": 1,
"tags": [],
"author_name": "Test User 1",
"stars_count": 0
},
"relationships": {
"author": {
"data": {
"id": "1",
"type": "author"
}
}
}
},
{
"id": "2",
"type": "grade",
"attributes": {
"grade": "A",
"remarks": null,
"created_at": "2020-06-25T13:37:51.049Z",
"updated_at": "2020-06-25T13:37:51.049Z"
},
"relationships": {
"project": {
"data": {
"id": "2",
"type": "project"
}
}
}
},
{
"id": "2",
"type": "project",
"attributes": {
"name": "Test User 2/Test Project 2",
"project_access_type": "Private",
"created_at": "2020-06-12T08:19:05.139Z",
"updated_at": "2020-06-12T08:19:05.139Z",
"image_preview": {
"url": "/img/default.png"
},
"description": null,
"view": 1,
"tags": [],
"author_name": "Test User 2",
"stars_count": 0
},
"relationships": {
"author": {
"data": {
"id": "2",
"type": "author"
}
}
}
}
],
"links": {
"self": "http://localhost:3000/api/v1/groups/1/assignments?page[number]=1",
"first": "http://localhost:3000/api/v1/groups/1/assignments?page[number]=1",
"prev": null,
"next": null,
"last": "http://localhost:3000/api/v1/groups/1/assignments?page[number]=1"
}
}
GET Assignment details
You can GET assignment details (identified by :id
) in /api/v1/assignments/:id/
. Authentication token
is passed through Authorization
header and is required.
URL Parameters
Parameter | Description |
---|---|
id |
The id of the assignment to be detailed |
URL Query Paramters
Parameter | Description |
---|---|
include |
Adds passed params details in included |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
403 | When authenticated user is neither mentor nor user of the Group |
404 | When the requested assignment identified by id does not exists. |
GET /api/v1/assignments/:id?include=grades,projects HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 200 OK
JSON response example:
{
"data": {
"id": "1",
"type": "assignment",
"attributes": {
"name": "Test assignment 1",
"deadline": "2021-05-24T11:47:40.244Z",
"description": "assignment description",
"created_at": "2020-05-24T11:47:40.244Z",
"updated_at": "2020-05-24T11:47:40.244Z",
"status": "open",
"restrictions": "[\"Input\",\"ConstantVal\",\"Splitter\",\"Random\"]",
"has_mentor_access": true,
"current_user_project_id": null,
"grading_scale": "no_scale",
"grades_finalized": false
},
"relationships": {
"projects": {
"data": [
{
"id": "1",
"type": "project"
}
]
},
"grades": {
"data": [
{
"id": "1",
"type": "grade"
}
]
}
},
"included": [
{
"id": "1",
"type": "grade",
"attributes": {
"grade": "A",
"remarks": null,
"created_at": "2020-06-25T13:37:51.049Z",
"updated_at": "2020-06-25T13:37:51.049Z"
},
"relationships": {
"project": {
"data": {
"id": "1",
"type": "project"
}
}
}
},
{
"id": "1",
"type": "project",
"attributes": {
"name": "Test User 1/Project 1",
"project_access_type": "Private",
"created_at": "2020-06-12T08:19:05.139Z",
"updated_at": "2020-06-12T08:19:05.139Z",
"image_preview": {
"url": "/img/default.png"
},
"description": null,
"view": 1,
"tags": [],
"author_name": "Test User 1",
"stars_count": 0
},
"relationships": {
"author": {
"data": {
"id": "2",
"type": "author"
}
}
}
}
]
}
}
POST Assignment
You can POST assignment in /api/v1/groups/:group_id/assignments
. Authentication token
is passed through Authorization
header and is required.
List of acceptable params for post request include:
Name | Type | Description |
---|---|---|
name |
String |
Name of the Assignment |
deadline |
String |
Updated name of the group |
description |
String |
Description of the assignment |
grading_scale |
String |
grading scale for the assignment |
restrictions |
JSON encoded array |
restrictions for assignments in json string |
URL Parameters
Parameter | Description |
---|---|
group_id |
The id of the group, assignment is to be added |
URL Query Paramters
Parameter | Description |
---|---|
include |
Adds passed params details in included |
Possible exceptions
Error Code | Description |
---|---|
400 | When invalid parameters are used. |
401 | When user is not authenticated i.e invalid or corrupt token . |
403 | When non-mentor user tries to add the assignment |
404 | When the requested group identified by group_id does not exists. |
POST /api/v1/groups/:group_id/assignments HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
{
"name": "Test assignment",
"deadline": "date_time_string",
"description": "Test description",
"grading_scale": "letter",
"restrictions": "[\"Input\",\"ConstantVal\",\"Splitter\",\"Random\"]"
}
HTTP/1.1 202 ACCEPTED
Content-Type: application/json
JSON response example:
{
"data": {
"id": "1",
"type": "assignment",
"attributes": {
"name": "Test Assignment",
"deadline": "2020-06-18T18:00:00.000Z",
"description": "",
"status": "open",
"restrictions": "[\"Input\",\"ConstantVal\",\"Splitter\",\"Random\"]",
"has_mentor_access": true,
"current_user_project_id": null,
"created_at": "2020-06-11T10:34:55.009Z",
"updated_at": "2020-06-25T16:55:42.317Z",
"grading_scale": "letter",
"grades_finalized": false
},
"relationships": {
"projects": {
"data": []
},
"grades": {
"data": []
}
}
}
}
UPDATE Assignment
You can PATCH assignment details in /api/v1/assignments/:id
. Authentication token
is passed through Authorization
header and is required.
List of acceptable params for put/patch request include:
Name | Type | Description |
---|---|---|
name |
String |
Name of the Assignment |
deadline |
String |
Updated name of the group |
description |
String |
Description of the assignment |
restrictions |
JSON String |
restrictions for assignments in json string |
URL Parameters
Parameter | Description |
---|---|
id |
The id of the assignment to be updated |
Possible exceptions
Error Code | Description |
---|---|
400 | When invalid parameters are used. |
401 | When user is not authenticated i.e invalid or corrupt token . |
403 | When non-mentor user tries to update the assignment |
404 | When the requested assignment identified by id does not exists. |
PATCH /api/v1/assignments/:id HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
{
"name": "Test assignment Updated",
"deadline": "date_time_string",
"description": "Test description",
"restrictions": "[\"Input\",\"Splitter\",\"Random\"]"
}
HTTP/1.1 202 ACCEPTED
Content-Type: application/json
JSON response example:
{
"data": {
"id": "1",
"type": "assignment",
"attributes": {
"name": "Test Assignment Updated",
"deadline": "2020-06-18T18:00:00.000Z",
"description": "Test description",
"status": "open",
"restrictions": "[\"Input\",\"Splitter\",\"Random\"]",
"has_mentor_access": true,
"current_user_project_id": null,
"created_at": "2020-06-11T10:34:55.009Z",
"updated_at": "2020-06-25T16:55:42.317Z",
"grading_scale": "letter",
"grades_finalized": false
},
"relationships": {
"projects": {
"data": []
},
"grades": {
"data": []
}
}
}
}
DELETE Assignment
Group mentor can DELETE a assignment (identified by :id
) in /api/v1/assignments/:id/
. Authentication token
is passed through Authorization
header and is required.
URL Parameters
Parameter | Description |
---|---|
id |
The id of the assignment to be deleted |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
403 | When non-mentor user tries to delete the assignment |
404 | When the requested assignment identified by id does not exists. |
DELETE /api/v1/assignment/:id HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 204 NO CONTENT
Content-Type: application/json
REOPEN Assignment
Mentor can REOPEN a closed assignment to extend the deadline by 1 day in /api/v1/assignments/:id/reopen
. Authentication token
is passed through Authorization
header and is required.
URL Parameters
Parameter | Description |
---|---|
id |
The id of the assignment to be reopened |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
403 | When authenticated user is neither mentor nor user of the Group |
404 | When the requested assignment identified by id does not exists. |
409 | When the requested assignment identified by id is already opened. |
PATCH /api/v1/assignments/:id/reopen HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 202 ACCEPTED
JSON response example:
{
"message": "Assignment has been reopened!"
}
START Assignment
Group Members can start working on the assignment in/api/v1/assignments/:id/start
. This creates a new private project for he user to work upon. Authentication token
is passed through Authorization
header and is required.
URL Parameters
Parameter | Description |
---|---|
id |
The id of the assignment to be start working on |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
403 | When authenticated user isn't a user of the Group, assignment is part of |
404 | When the requested assignment identified by id does not exists. |
PATCH /api/v1/assignments/:id/start HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 201 CREATED
JSON response example:
{
"message": "Voila! Project set up under name #{@project.name}"
}
Grades
CREATE/ADD Grade
You can grade an assignment in /api/v1/assignments/:assignment_id/projects/:project_id/grades
. Authentication token
is passed through Authorization
header and is required.
URL Parameters
Parameter | Description |
---|---|
assignment_id |
The id of the assignment project belongs to |
project_id |
The id of the the project you wish to grade |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
403 | When non-mentor user tries to grade the assignment |
404 | When the assignment identified by assignment_id does not exists. |
422 | When created grade has validation errors |
POST /api/v1/assignments/:assignment_id/projects/:project_id/grade HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
{
"grade": {
"grade": "A",
"remarks": "This is the remark.."
}
}
HTTP/1.1 201 CREATED
JSON response example:
{
"data": {
"id": "1",
"type": "grade",
"attributes": {
"grade": "A",
"remarks": "This is the remark..",
"created_at": "2020-06-11T04:02:44.466Z",
"updated_at": "2020-06-11T04:02:44.466Z"
},
"relationships": {
"project": {
"data": {
"id": "1",
"type": "project"
}
}
}
}
}
UPDATE Grade
You can update grade identified by :id
in /api/v1/grades/:id
. Authentication token
is passed through Authorization
header and is required.
URL Parameters
Parameter | Description |
---|---|
id |
The id of the grade to be updated |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
403 | When non-mentor user tries to update grade for the assignment |
404 | When the grade identified by id does not exists. |
422 | When updated grade has validation errors |
POST /api/v1/assignments/:assignment_id/projects/:project_id/grade HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
{
"grade": {
"grade": "B",
"remarks": "This is the updated remark.."
}
}
HTTP/1.1 202 ACCEPTED
JSON response example:
{
"data": {
"id": "1",
"type": "grade",
"attributes": {
"grade": "B",
"remarks": "This is the updated remark..",
"created_at": "2020-06-11T04:02:44.466Z",
"updated_at": "2020-06-11T04:02:44.466Z"
},
"relationships": {
"project": {
"data": {
"id": "1",
"type": "project"
}
}
}
}
}
DELETE Grade
Group mentor can DELETE a grade (identified by :id
) in /api/v1/grades/:id/
. Authentication token
is passed through Authorization
header and is required.
URL Parameters
Parameter | Description |
---|---|
id |
The id of the grade to be deleted |
Possible exceptions
Error Code | Description |
---|---|
401 | When user is not authenticated i.e invalid or corrupt token . |
403 | When non-mentor user tries to delete the grade |
404 | When the requested grade identified by id does not exists. |
DELETE /api/v1/grades/:id HTTP/1.1
Accept: application/json
Authorization: Token {token}
Host: localhost
HTTP/1.1 204 NO CONTENT
Content-Type: application/json