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.
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.
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.
{"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.
{"data":{"id":"1","type":"user","attributes":{"id":1,"email":"test@test1.com","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.
{"data":{"id":"1","type":"user","attributes":{"id":1,"email":"test@test1.com","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
{"data":{"id":"1","type":"user","attributes":{"id":1,"email":"test@test1.com","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 numberth 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
Possible exceptions
Error Code
Description
401
When user tries to authenticate with invalid or corrupt token.
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 numberth 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
Possible exceptions
Error Code
Description
401
When user is not authenticated i.e invalid or corrupt token
{"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 1","email":"test@test.com"},"relationships":{"projects":{"data":[{"id":"1","type":"project"}]}}}]}
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
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.
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 numberth 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.
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.
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.
JSON response example (including group_members & assignments):
{"data":[{"id":"1","type":"group","attributes":{"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":{"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":{"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":{"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","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","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":"test@test1.com"}},{"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":"test@test2.com"}},{"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":"test@test3.com"}},{"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":"test@test4.com"}},{"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":"test@test5.com"}}],"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 numberth 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.
{"data":{"id":"1","type":"group","attributes":{"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","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":"test@test1.com"}}]}
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.
{"group":{"name":"Group Name Updated"//otherparamsheretoo}}
HTTP/1.1202ACCEPTEDContent-Type:application/json
JSON response example:
{"data":{"id":"1","type":"group","attributes":{"name":"Group Name Updated","mentor_id":1,"created_at":"2020-02-25T18:15:39.825Z","updated_at":"2020-05-26T02:54:52.914Z"},"relationships":{"group_members":{"data":[{"id":"1","type":"group_member"}]},"assignments":{"data":[{"id":"1","type":"assignment"}]}}}}
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.
You can GET all group members for a particular group in /api/v1/groups/:group_id/group_members. Authentication token is passed through Authorization header and is required.
URL Query Parameters
Parameter
Description
page[number]
The numberth 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.
{"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":"test@test.com"}}],"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/group_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.
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.
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 numberth 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.
403
When user without show access tries to fetch assignments
404
When the group identified by :group_id does not exist
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
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.
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.
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.
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.
{"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.
{"grade":{"grade":"A","remarks":"This is the remark.."}}
HTTP/1.1201CREATED
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"}}}
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
{"grade":{"grade":"B","remarks":"This is the updated remark.."}}
HTTP/1.1202ACCEPTED
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"}}}
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.