-
Notifications
You must be signed in to change notification settings - Fork 1
API Endpoints
The Application Portal API exposes resources like forms, categories, and applications for logged in users and is used extensively by the frontend.
The following are relevant objects exposed by the API endpoints, which may be slightly different than their counterparts in the database models for performance and ease of use reasons:
This object is slightly different than the form object in the models. Its attributes are:
-
id
: Primary key of the form (integer). -
name
: Human-readable name of the form (string). -
created_at
: Timestamp of the form (Unix datetime string). -
archived
: Whether or not the form is archived (bool). -
questions
: A nested list ofquestion
objects.
-
id
: Primary key of the question (integer). -
form
: Foreign key/ID of the associated form (integer). -
question_text
: Human-readable question text (string). -
question_type
:'Paragraph'
,'Checkbox'
,'Radiobutton'
, or'Dropdown'
(string). -
options
: Stringified list of question options, where each option is a string.
-
id
: Primary key of the category (integer). -
form
: Foreign key/ID of the associated form (integer). -
name
: Human-readable name of the category (string). -
applications
: List ofapplication
objects, in order, that make up the first page of the category's associated applications.
-
id
: Primary key of the application (integer). -
category
: Foreign key/ID of the associated category (integer). -
email
: Email of the applicant (string). -
first_name
: First name of the applicant (string). -
last_name
: Last name of the applicant (string). -
read
: Whether or not a reader has reviewed the application yet (bool). -
answers
: A dictionary ofanswer
objects indexed by answer ID.
-
id
: Primary key of the answer (integer). -
application
: Foreign key/ID of the associated application (integer). -
question
: Foreign key/ID of the associated question (integer). -
answer_text
: The answer text (string). This may be a stringified list depending on the question type.
The following are API endpoints that make use of the above objects.
Gets the full list of forms as form objects. Each form object should also contain the list of question objects associated with it, in the correct order.
{
'forms': [
{
'id': 4,
'name': 'Consulting Spring 2018',
'created_at': '2017/12/07 17:55:48 +0000',
'archived': false,
'questions': [
{
'id': 1,
'form': 4,
'question_text': 'Check the classes you have taken:',
'question_type': 'Checkbox',
'options': "['CS61A', 'CS61B', 'CS61C']",
},
{
'id': 2,
'form': 4,
'question_text': 'Why CodeBase?',
'question_type': 'Paragraph',
'options': '',
},
],
},
{
'id': 3,
'name': 'Mentored Spring 2018',
'created_at': '2017/12/07 17:55:00 +0000',
'archived': true,
'questions': [
{
'id': 3,
'form': 3,
'question_text': 'Check the classes you have taken:',
'question_type': 'Checkbox',
'options': "['CS61A', 'CS61B', 'CS61C']",
},
{
'id': 4,
'form': 3,
'question_text': 'Why CodeBase?',
'question_type': 'Paragraph',
'options': '',
},
],
},
],
};
-
forms
: List ofform
objects
Gets all the categories for a particular form with the given <id>
. This consists of a list of category objects, and each category object should have an applications
attribute containing a list of application objects corresponding to the first page of the inbox for that category.
{
'form': 4,
'categories': [
{
'id': 2,
'form': 4,
'name': 'Accepted',
'applications': [
{
'id': 5,
'category': 2,
'email': '[email protected]',
'first_name': 'Ivon',
'last_name': 'Liu',
'read': true,
'answers': {
'9': {
'id': 9,
'application': 5,
'question': 1,
'answer_text': "['CS61A', 'CS61B']",
},
'10': {
'id': 10,
'application': 5,
'question': 2,
'answer_text': 'I do whatever the fuck I want',
},
},
},
],
},
{
'id': 3,
'form': 4,
'name': 'Rejected',
'applications': [
{
'id': 6,
'category': 3,
'email': '[email protected]',
'first_name': 'Andrew',
'last_name': 'Chan',
'read': true,
'answers': {
'11': {
'id': 11,
'application': 6,
'question': 1,
'answer_text': "['CS61B']",
},
'12': {
'id': 12,
'application': 6,
'question': 2,
'answer_text': 'Poopy butthole',
},
},
},
],
},
],
};
-
form
: ID of the form associated with these categories -
categories
: List ofcategory
objects associated with the given form