academical-api-client v0.1.0
api-client-node
Official Academical API library client for node.js
This library is generated by alpaca
Installation
Make sure you have npm installed.
$ npm install academical-api-clientVersions
Works with 0.8 / 0.9 / 0.10 / 0.11
Usage
var academical = require('academical-api-client');
// Then we instantiate a client (as shown below)Build a client
Using this api without authentication gives an error
Authorization header token
var client = academical.client('1a2b3', clientOptions);Client Options
The following options are available while instantiating a client:
- base: Base url for the api
 - api_version: Default version of the api (to be used in url)
 - user_agent: Default user-agent for all requests
 - headers: Default headers for all requests
 - request_type: Default format of the request body
 
Response information
All the callbacks provided to an api call will recieve the response as shown below
// You can also omit the 'methodOptions' param below
client.klass('args').method('args', methodOptions, function (err, response) {
    if (err) console.log(err);
    response.code;
    // >>> 200
    response.headers;
    // >>> {'x-server': 'apache'}
}JSON response
When the response sent by server is json, it is decoded into a hash
response.body;
// >>> {'user': 'pksunkara'}Method Options
The following options are available while calling a method of an api:
- api_version: Version of the api (to be used in url)
 - headers: Headers for the request
 - query: Query parameters for the url
 - body: Body of the request
 - request_type: Format of the request body
 
Request body information
Set request_type in options to modify the body accordingly
Schools api
All schools that are using Academical
var schools = client.schools();Get a school (GET /schools/:id)
Returns a school object given its ID
The following arguments are required:
- id: ID of the school
 
schools.get("5593455069702d5d40000095", options, callback);Delete a school (DELETE /schools/:id)
Delete a school from the API given its ID
The following arguments are required:
- id: ID of the school
 
schools.delete("5593455069702d5d40000095", options, callback);Get all schedules on a school (GET /schools/:id/schedules)
Returns a list of schedules that have been created in a given school
The following arguments are required:
- id: ID of the school
 
schools.schedules("5593455069702d5d40000095", options, callback);Get all students on a school (GET /schools/:id/students)
Returns a list of students for a given school
The following arguments are required:
- id: ID of the school
 
schools.students("5593455069702d5d40000095", options, callback);Get all sections on a school (GET /schools/:id/sections)
Returns a list of sections for a given school
The following arguments are required:
- id: ID of the school
 
schools.sections("5593455069702d5d40000095", options, callback);Get all teachers registered to a school (GET /schools/:id/teachers)
Return a list of teachers for a given school
The following arguments are required:
- id: ID of the school
 
schools.teachers("5593455069702d5d40000095", options, callback);Create a new school (POST /schools/)
Creates a new school object in Academical. All required parameters must be provided
The following arguments are required:
- name: Name of the school
 - nickname: Nickname of the school
 - locale: Locale of the school
 - timezone: Timezone of the school
 - departments: A list of Department objects. Each department should specify a name and faculty_name
 - identity_providers: A list of Identify Providers to use with this school
 - app_ui: Object describing UI specific parameters for our planner app
 - terms: A list containing Term objects. Each term should define a name, a start date and end date.
 
schools.create(
 "Example University",
 "example-university",
  "en",
 "America/Bogota",
 [{'name': 'Medicine', 'faculty_name' : '' }],
 ["example.edu.co", "facebook"],
 { "info_fields:" [], "search_filters":[], "search_result_fields": [], "summary_fields:"[] },
 [{"end_date":"2015-11-14", "name":"2015-2", "start_date":"2015-07-27"}],
 options
);Update a new School (PUT /schools/:id/)
Update a new school in Academical. You must provide all of the required parameters
The following arguments are required:
- id: Generated ID for the school
 - name: Name of the school
 - nickname: Nickname of the school
 - locale: Locale of the school
 - timezone: Timezone of the school
 - departments: A list of Department objects. Each department should specify a name and faculty_name
 - identity_providers: A list of Identify Providers to use with this school
 - app_ui: Object describing UI specific parameters for our planner app
 - terms: A list containing Term objects. Each term should define a name, a start date and end date.
 
schools.update(
"5593455069702d5d40000095",
 "Example University",
 "example-university",
  "en",
 "America/Bogota",
 [{'name': 'Medicine', 'faculty_name' : '' }],
 ["example.edu.co", "facebook"],
 { "info_fields:" [], "search_filters":[], "search_result_fields": [], "summary_fields:"[] },
 [{"end_date":"2015-11-14", "name":"2015-2", "start_date":"2015-07-27"}],
 options
);Section api
Represents the section of a course in a school
var sections = client.sections();Get section (GET /sections/:id)
Returns a section object given its ID
The following arguments are required:
- id: ID of the section
 
sections.get("55a5385969702d1b41020d39", options, callback);Delete section (DELETE /sections/:id)
Delete a section given its ID
The following arguments are required:
- id: ID of the section
 
sections.delete("55a5385969702d1b41020d39", options, callback);Create a new section (POST /sections/)
Creates a new section object in Academical. All required parameters must be provided.
The following arguments are required:
- course_name: Name of the course
 - course_code: The code of the course which this section belongs to
 - section_number: Section number of the course. This is X of Y sections for course K
 - section_id: Unique identifier for the section
 - term: The term object this section will be taking place in
 - seats: Object describing the number of available, taken and total seats for the section
 - school_id: ID of the school this section belongs to
 - events: A list of events this section takes place on
 - departments: List of departments this section belongs to.
 - credits: Number of credits this course is worth
 
sections.create(
  "Medicine 101",
 "MEDI1000",
 "3",
 "16934",
 "See https://academical.readme.io/docs/resources#term-embedded",
 {"available":"", "taken":"", "total":""},
 "5593455069702d5d40000000",
 "See https://academical.readme.io/docs/resources#event-embedded",
 [{ name: "Medicine" faculty_name: "" }],
 "3",
 options
);Update a section (PUT /sections/:id)
Update the attributes of a section given its ID as a part of the body of the request
The following arguments are required:
- id: ID of the section
 - course_name: Name of the course
 - course_code: The code of the course which this section belongs to
 - section_number: Section number of the course. This is X of Y sections for course K
 - section_id: Unique identifier for the section
 - term: The term object this section will be taking place in
 - seats: Object describing the number of available, taken and total seats for the section
 - school_id: ID of the school this section belongs to
 - events: A list of events this section takes place on
 - departments: List of departments this section belongs to.
 - credits: Number of credits this course is worth
 
sections.update(
 "5634f74c66c2b7163200a6dc",
  "Medicine 101",
 "MEDI1000",
 "3",
 "16934",
 "See https://academical.readme.io/docs/resources#term-embedded",
 {"available":"", "taken":"", "total":""},
 "5593455069702d5d40000000",
 "See https://academical.readme.io/docs/resources#event-embedded",
 [{ name: "Medicine" faculty_name: "" }],
 "3",
 options
);Get the teachers of a section (GET /sections/:id/teachers)
Returns the list of teachers given a section ID
The following arguments are required:
- id: ID of the section
 
sections.teachers("5634f74c66c2b7163200a6dc", options, callback);Get the schedules of a section (GET /sections/:id/schedules)
List of all the schedules with a given section
The following arguments are required:
- id: ID of the section
 
sections.schedules("5634f74c66c2b7163200a6dc", options, callback);Teachers api
A teacher in a school.
var teachers = client.teachers();Get teacher (GET /teachers/:id)
Get a teacher given its ID
The following arguments are required:
- id: ID of the teacher
 
teachers.get("5593465369702d5d420059fe", options, callback);Delete teacher (DELETE /teachers/:id)
Delete a teacher given its ID
The following arguments are required:
- id: ID of the teacher
 
teachers.delete("5593465369702d5d420059fe", options, callback);Create a new teacher (POST /teachers/)
Create a new teacher in Academical. You must provide all of the required values
The following arguments are required:
- name: Object with the name of the teacher
 - school_id: ID of the school which this teacher belongs to
 
teachers.create({"first":"FELIPE","last":"PENAGOS","middle":"JUAN","other":"SERNA"}, "5593455069702d5d40000000", options, callback);Updates a teacher (PUT /teachers/:id)
Update a teacher in Academical. You must provide all of the required parameters
The following arguments are required:
- id: ID of the teacher
 - name: Object with the name of the teacher
 - school_id: ID of the school which this teacher belongs to
 
teachers.update("5593465369702d5d420059fe", {"first":"FELIPE","last":"PENAGOS","middle":"JUAN","other":"SERNA"}, "5593455069702d5d40000000", options, callback);Contributors
Here is a list of Contributors
TODO
License
MIT
Bug Reports
Report here.
Contact
Academical (support+developers@academical.co)
10 years ago