MySU Web API
Unofficial Sabanci University MySU Web API.
Install
npm i mysu-api
Usage
MySU does not allow CORS requests, so requests made while developing on web gets HTTP 400. You can create mysu
instance with bypassCORS configuration as a workaround.
Requests will be made through a proxy if bypassCORS
is set to true. It drastically reduces the performance. If requests are not cross domain, set bypassCORS
to false
.
const mysu = bypassCORS: true ;
Refer to Table of contents for all available functions.
let res = await mysu;/*res => [ { "username": "eralpsahin", "name": "Eralp Şahin", "birthday": "2019-11-09", "photo": "http://suisimg.sabanciuniv.edu/photos/000018105237389123.jpg", "degree": " ", "program": " " }]*/
Description
MySU API does not require authentication. It does not cross check the requested username. Without any authentication one can get anyones private information
let data = await mysu;/*data => { meals: [...], prints: [...], transports: [...]}*/
API
Table of Contents
authenticate
This function authenticates the user to MySU app.
Server does not need authentication for other requests. Ultimately, authentication is not needed.
Parameters
Returns Number Error code of the response
sucard
This function retrieves SuCard transaction records from MySU.
Parameters
username
string SU-Net username
Returns Object SuCard transaction record object with meals
, transports
, prints
keys.
courseSchedule
This function retrieves Course Schedule of a student.
Parameters
username
string SU-Net username
Returns Object Object containing {courseCDN: courseTitle} fields.
getPerson
Parameters
search
String Search string.type
String Peoples type: alumni - student - staff. (optional, default"student"
)limit
(string | number) Limit the number of people returned. (optional, default""
)start
(string | number) Return the people starting from start index. (optional, default0
)
Returns Array Array of person objects as in the example above.
License
MIT © Eralp Sahin