In every semester, Department of Software Engineering of the Daffodil International University provides class schedule in .xlsx file format.
Mobile | Desktop |
---|---|
It's not an easy task for a student to find class schedule of 6 working days from a lot of data. To solve this problem, routine-explorer comes with the idea to help students finding their class schedule in a 6 x 6 GRID where :
- Student's can select the latest routine version provided by the department
- Search for classes of 5 (max) courses through the keyword pattern 'Course Name' + 'Section'.
In it's v3.0 it has arrive with API so that some other applications like:
- Room booking (By using the data of unused rooms)
- Weekly class tracking of each room
- Schedule maker of teachers using initials
- Most importantly "MOBILE" applications can be built.
Rest of the part of this documentation will be discussed on module-wise API so that people willing to built applications for the Dept. of SWE, can gather some idea on how to use these APIs. Currently available APIs are:
- Get all available routines
- Find latest routine version
- Get unused rooms
- Find all class schedules
- Get schedule by subjects
- Find schedule by teacher initials
In addition, there are some example code snippets to understand how to deal with these APIs. Code snippets are available in:
- Kotlin (OK HTTP3)
- Flutter (http)
- Xamarin (C# RestSharp)
To get the list of routines of different versions, you need to hit the api at api/versions
. For example, if you hit a
GET
request:
- at localhost -
https://localhost:5000/api/versions
- at heroku -
https://routine-explorer.herokuapp.com/api/versions
After successful execution server will respond with an Array of Objects like below :
[
{
"id": 1,
"nameOfFilesUploaded": "Spring 2020 Version-2",
"statusOfPublish": true,
"timeOfUpload": "2020-01-23T23:27:22.8211125"
}
]
Here are some code snippets that might help you dealing with the API at
api/versions
:
- Kotlin: OkHTTP3
import okhttp3.RequestBody.Companion.toRequestBody
fun main(args: Array) {
var client = OkHttpClient()
var request = Request.Builder()
.url("https://routine-explorer.herokuapp.com/api/versions")
.get()
.addHeader("Accept", "*/*")
.addHeader("Cache-Control", "no-cache")
.addHeader("Host", "https://routine-explorer.herokuapp.com")
.addHeader("Accept-Encoding", "gzip, deflate")
.addHeader("Connection", "keep-alive")
.addHeader("cache-control", "no-cache")
.build()
var response = client.newCall(request).execute()
}
- Flutter: (HTTP)
import 'package:http/http.dart' as http;
var url = 'https://routine-explorer.herokuapp.com/api/versions';
var response = await http.get(url);
print('Response body: ${response.body}');
- Xamarin (RestSharp)
var client = new RestClient("https://routine-explorer.herokuapp.com/api/versions");
var request = new RestRequest(Method.GET);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("Connection", "keep-alive");
request.AddHeader("Accept-Encoding", "gzip, deflate");
request.AddHeader("Host", "https://routine-explorer.herokuapp.com");
request.AddHeader("Cache-Control", "no-cache");
request.AddHeader("Accept", "*/*");
IRestResponse response = client.Execute(request);
To get the latest version of routine object you need to hit the api at api/versions/GetLatestVersion
. For example, if you hit a
GET
request:
- at localhost -
https://localhost:5000/api/versions/GetLatestVersion
- at heroku -
https://routine-explorer.herokuapp.com/api/versions/GetLatestVersion
Then a successful execution will respond with a single object like JSON snippet below :
{
"id": 1,
"nameOfFilesUploaded": "Spring 2020 Version-2",
"statusOfPublish": true,
"timeOfUpload": "2020-01-23T23:27:22.8211125"
}
- Kotlin: OkHTTP3
import okhttp3.RequestBody.Companion.toRequestBody
fun main(args: Array) {
var client = OkHttpClient()
var request = Request.Builder()
.url("https://routine-explorer.herokuapp.com/api/versions/GetLatestVersion")
.get()
.addHeader("Accept", "*/*")
.addHeader("Cache-Control", "no-cache")
.addHeader("Host", "https://routine-explorer.herokuapp.com")
.addHeader("Accept-Encoding", "gzip, deflate")
.addHeader("Connection", "keep-alive")
.addHeader("cache-control", "no-cache")
.build()
var response = client.newCall(request).execute()
}
- Flutter: (HTTP)
import 'package:http/http.dart' as http;
var url = 'https://routine-explorer.herokuapp.com/api/versions/GetLatestVersion';
var response = await http.get(url);
print('Response body: ${response.body}');
- Xamarin (RestSharp)
var client = new RestClient("https://routine-explorer.herokuapp.com/api/versions/GetLatestVersion");
var request = new RestRequest(Method.GET);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("Connection", "keep-alive");
request.AddHeader("Accept-Encoding", "gzip, deflate");
request.AddHeader("Host", "https://routine-explorer.herokuapp.com");
request.AddHeader("Cache-Control", "no-cache");
request.AddHeader("Accept", "*/*");
IRestResponse response = client.Execute(request);
In this context, you POST
to the api/vacant
and include a Routine-Version object to the body from the previous context.
For example, if you hit a POST
request:
- at localhost -
https://localhost:5000/api/vacant
- at heroku -
https://routine-explorer.herokuapp.com/api/vacant
and include a Routine-Version object to the body like:
{
"id": 1,
"nameOfFilesUploaded": "Spring 2020 Version-2",
"statusOfPublish": true,
"timeOfUpload": "2020-01-23T23:27:22.8211125"
}
Then you will get a response which is an array of object returning the unused rooms in that routine version you requested from the body like:
[
{
"id": 1,
"roomNumber": "505AB",
"dayOfWeek": "Wednesday",
"timeRange": "10:00-11:30",
"status": null
},
{
"id": 2,
"roomNumber": "505AB",
"dayOfWeek": "Wednesday",
"timeRange": "08:30-10:00",
"status": null
}]
- HTTP Request Snippet Example
POST /api/vacant HTTP/1.1
Host: https://routine-explorer.herokuapp.com
Content-Type: application/json
Accept: */*
Cache-Control: no-cache
Host: https://routine-explorer.herokuapp.com
Accept-Encoding: gzip, deflate
Content-Length: 147
Connection: keep-alive
cache-control: no-cache
{
"id": 1,
"nameOfFilesUploaded": "Spring 2020 Version-2",
"statusOfPublish": true,
"timeOfUpload": "2020-01-23T23:27:22.8211125"
}
- Kotlin: OkHTTP3
import okhttp3.RequestBody.Companion.toRequestBody
fun main(args: Array) {
var client = OkHttpClient()
var mediaType = MediaType.parse("application/json")
var body = RequestBody.create(mediaType, "{\n \"id\": 1,\n \"nameOfFilesUploaded\": \"Spring 2020 Version-2\",\n \"statusOfPublish\": true,\n \"timeOfUpload\": \"2020-01-23T23:27:22.8211125\"\n}")
var request = Request.Builder()
.url("https://routine-explorer.herokuapp.com/api/vacant")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "*/*")
.addHeader("Cache-Control", "no-cache")
.addHeader("Host", "https://routine-explorer.herokuapp.com")
.addHeader("Accept-Encoding", "gzip, deflate")
.addHeader("Content-Length", "147")
.addHeader("Connection", "keep-alive")
.addHeader("cache-control", "no-cache")
.build()
var response = client.newCall(request).execute()
}
- Flutter: (HTTP)
import 'package:http/http.dart' as http;
var url = 'https://routine-explorer.herokuapp.com/api/vacant';
var response = await http.post(url, body: {
'id': 1,
'nameOfFilesUploaded': 'Spring 2020 Version-2',
'statusOfPublish': true,
'timeOfUpload': '2020-01-23T23:27:22.8211125'
});
print('Response body: ${response.body}');
- Xamarin (RestSharp)
var client = new RestClient("https://routine-explorer.herokuapp.com/api/vacant");
var request = new RestRequest(Method.POST);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("Connection", "keep-alive");
request.AddHeader("Content-Length", "147");
request.AddHeader("Accept-Encoding", "gzip, deflate");
request.AddHeader("Host", "https://routine-explorer.herokuapp.com");
request.AddHeader("Cache-Control", "no-cache");
request.AddHeader("Accept", "*/*");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("status", "{\n \"id\": 1,\n \"nameOfFilesUploaded\": \"Spring 2020 Version-2\",\n \"statusOfPublish\": true,\n \"timeOfUpload\": \"2020-01-23T23:27:22.8211125\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
In this context, you hit GET
to the api/routine
and include a Routine-Version object.
For example, if you hit a GET
request:
- at localhost -
https://localhost:5000/api/routine
- at heroku -
https://routine-explorer.herokuapp.com/api/routine
and include a Routine-Version object to the body like:
{
"id": 1,
"nameOfFilesUploaded": "Spring 2020 Version-2",
"statusOfPublish": true,
"timeOfUpload": "2020-01-23T23:27:22.8211125"
}
Then you will get a response which is an array of object returning the class schedules in that routine version you requested from the body like:
[
{
"id": 1,
"roomNumber": "601AB",
"courseCode": "CS312A",
"teacher": "MAR",
"dayOfWeek": "Saturday",
"timeRange": "02:30-04:00",
"status": null
},
{
"id": 2,
"roomNumber": "305AB",
"courseCode": "ENG101A",
"teacher": "SM",
"dayOfWeek": "Tuesday",
"timeRange": "10:00-11:30",
"status": null
}
]
- HTTP Request Snippet Example
GET /api/routine HTTP/1.1
Host: https://routine-explorer.herokuapp.com
Content-Type: application/json
Accept: */*
Cache-Control: no-cache
Host: https://routine-explorer.herokuapp.com
Accept-Encoding: gzip, deflate
Content-Length: 147
Connection: keep-alive
cache-control: no-cache
{
"id": 1,
"nameOfFilesUploaded": "Spring 2020 Version-2",
"statusOfPublish": true,
"timeOfUpload": "2020-01-23T23:27:22.8211125"
}
- Kotlin: OkHTTP3
import okhttp3.RequestBody.Companion.toRequestBody
fun main(args: Array) {
var client = OkHttpClient()
var mediaType = MediaType.parse("application/json")
var body = RequestBody.create(mediaType, "{\n \"id\": 1,\n \"nameOfFilesUploaded\": \"Spring 2020 Version-2\",\n \"statusOfPublish\": true,\n \"timeOfUpload\": \"2020-01-23T23:27:22.8211125\"\n}")
var request = Request.Builder()
.url("https://routine-explorer.herokuapp.com/api/routine")
.get(body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "*/*")
.addHeader("Cache-Control", "no-cache")
.addHeader("Host", "https://routine-explorer.herokuapp.com")
.addHeader("Accept-Encoding", "gzip, deflate")
.addHeader("Content-Length", "147")
.addHeader("Connection", "keep-alive")
.addHeader("cache-control", "no-cache")
.build()
var response = client.newCall(request).execute()
}
- Flutter: (HTTP)
import 'package:http/http.dart' as http;
var url = 'https://routine-explorer.herokuapp.com/api/routine';
var response = await http.get(url, body: {
'id': 1,
'nameOfFilesUploaded': 'Spring 2020 Version-2',
'statusOfPublish': true,
'timeOfUpload': '2020-01-23T23:27:22.8211125'
});
print('Response body: ${response.body}');
- Xamarin (RestSharp)
var client = new RestClient("https://routine-explorer.herokuapp.com/api/routine");
var request = new RestRequest(Method.GET);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("Connection", "keep-alive");
request.AddHeader("Content-Length", "147");
request.AddHeader("Accept-Encoding", "gzip, deflate");
request.AddHeader("Host", "https://routine-explorer.herokuapp.com");
request.AddHeader("Cache-Control", "no-cache");
request.AddHeader("Accept", "*/*");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("status", "{\n \"id\": 1,\n \"nameOfFilesUploaded\": \"Spring 2020 Version-2\",\n \"statusOfPublish\": true,\n \"timeOfUpload\": \"2020-01-23T23:27:22.8211125\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
In this context, you POST
to the api/routine/GetRoutineByCourses
and include a subjects object to the body.
For example, if you hit a POST
request:
- at localhost -
https://localhost:5000/api/routine/GetRoutineByCourses
- at heroku -
https://routine-explorer.herokuapp.com/api/routine/GetRoutineByCourses
and include a subjects object to the body like:
{
"subject01": "SWE422A",
"subject02": null,
"subject03": "SWE425A",
"subject04": null,
"subject05": null,
"status" : {
"id": 1,
"nameOfFilesUploaded": "Spring 2020 Version-2",
"statusOfPublish": true,
"timeOfUpload": "2020-01-23T23:27:22.8211125"
}
}
Then you will get a response which is an array of object returning the class schedules in that routine version for the subjects you requested from the body like:
[
{
"id": 333,
"roomNumber": "405AB",
"courseCode": "SWE422A_LAB",
"teacher": "LR",
"dayOfWeek": "Sunday",
"timeRange": "10:00-11:30",
"status": null
},
{
"id": 358,
"roomNumber": "507MB",
"courseCode": "SWE425A_LAB",
"teacher": "ZI",
"dayOfWeek": "Sunday",
"timeRange": "04:00-05:30",
"status": null
}]
- Kotlin: OkHTTP3
import okhttp3.RequestBody.Companion.toRequestBody
fun main(args: Array) {
var client = OkHttpClient()
var mediaType = MediaType.parse("application/json")
var body = RequestBody.create(mediaType, "{\n\t\"subject01\": \"SWE422A\",\n\t\"subject02\": null,\n\t\"subject03\": \"SWE425A\",\n\t\"subject04\": null,\n\t\"subject05\": null,\n\t\"status\" : {\n\t\t\t \"id\": 1,\n\t\t\t \"nameOfFilesUploaded\": \"Spring 2020 Version-2\",\n\t\t\t \"statusOfPublish\": true,\n\t\t\t \"timeOfUpload\": \"2020-01-23T23:27:22.8211125\"\n\t\t\t }\n}")
var request = Request.Builder()
.url("https://routine-explorer.herokuapp.com/api/routine/GetRoutineByCourses")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "*/*")
.addHeader("Cache-Control", "no-cache")
.addHeader("Host", "https://routine-explorer.herokuapp.com")
.addHeader("Accept-Encoding", "gzip, deflate")
.addHeader("Content-Length", "295")
.addHeader("Connection", "keep-alive")
.addHeader("cache-control", "no-cache")
.build()
var response = client.newCall(request).execute()
}
- Flutter: (HTTP)
import 'package:http/http.dart' as http;
var url = 'https://routine-explorer.herokuapp.com/api/routine/GetRoutineByCourses';
var response = await http.get(url, body: {
'subject01': 'SWE422A',
'subject02': null,
'subject03': 'SWE425A',
'subject04': null,
'subject05': null,
'status' : {
'id': 1,
'nameOfFilesUploaded': 'Spring 2020 Version-2',
'statusOfPublish': true,
'timeOfUpload': '2020-01-23T23:27:22.8211125'
}
});
print('Response body: ${response.body}');
- Xamarin (RestSharp)
var client = new RestClient("https://routine-explorer.herokuapp.com/api/routine/GetRoutineByCourses");
var request = new RestRequest(Method.POST);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("Connection", "keep-alive");
request.AddHeader("Content-Length", "295");
request.AddHeader("Accept-Encoding", "gzip, deflate");
request.AddHeader("Host", "localhost:5000");
request.AddHeader("Cache-Control", "no-cache");
request.AddHeader("Accept", "*/*");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\n\t\"subject01\": \"SWE422A\",\n\t\"subject02\": null,\n\t\"subject03\": \"SWE425A\",\n\t\"subject04\": null,\n\t\"subject05\": null,\n\t\"status\" : {\n\t\t\t \"id\": 1,\n\t\t\t \"nameOfFilesUploaded\": \"Spring 2020 Version-2\",\n\t\t\t \"statusOfPublish\": true,\n\t\t\t \"timeOfUpload\": \"2020-01-23T23:27:22.8211125\"\n\t\t\t }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
In this context, you POST
to the api/routine/GetScheduleForTeacher
and include a teacher object to the body.
For example, if you hit a POST
request:
- at localhost -
https://localhost:5000/api/routine/GetScheduleForTeacher
- at heroku -
https://routine-explorer.herokuapp.com/api/routine/GetScheduleForTeacher
and include a teacher object to the body like:
{
"teacherInitial": "MAH",
"status" : {
"id": 1,
"nameOfFilesUploaded": "Spring 2020 Version-2",
"statusOfPublish": true,
"timeOfUpload": "2020-01-23T23:27:22.8211125"
}
}
Then you will get a response which is an array of object returning the class schedules in that routine version for the teacher you requested from the body like:
[
{
"id": 333,
"roomNumber": "405AB",
"courseCode": "SWE422A_LAB",
"teacher": "MAH",
"dayOfWeek": "Sunday",
"timeRange": "10:00-11:30",
"status": null
},
{
"id": 358,
"roomNumber": "507MB",
"courseCode": "SWE425A_LAB",
"teacher": "MAH",
"dayOfWeek": "Sunday",
"timeRange": "04:00-05:30",
"status": null
}]
- Kotlin: OkHTTP3
import okhttp3.RequestBody.Companion.toRequestBody
fun main(args: Array) {
var client = OkHttpClient()
var mediaType = MediaType.parse("application/json")
var body = RequestBody.create(mediaType, "{\n\t\"TeacherInitial\": \"MAH\",\n\t\"status\" : {\n\t\t\t \"id\": 1,\n\t\t\t \"nameOfFilesUploaded\": \"Spring 2020 Version-2\",\n\t\t\t \"statusOfPublish\": true,\n\t\t\t \"timeOfUpload\": \"2020-01-23T23:27:22.8211125\"\n\t\t\t }\n}")
var request = Request.Builder()
.url("https://routine-explorer.herokuapp.com/api/routine/GetScheduleForTeacher")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "*/*")
.addHeader("Cache-Control", "no-cache")
.addHeader("Host", "https://routine-explorer.herokuapp.com")
.addHeader("Accept-Encoding", "gzip, deflate")
.addHeader("Content-Length", "211")
.addHeader("Connection", "keep-alive")
.addHeader("cache-control", "no-cache")
.build()
var response = client.newCall(request).execute()
}
- Flutter: (HTTP)
import 'package:http/http.dart' as http;
var url = 'https://routine-explorer.herokuapp.com/api/routine/GetScheduleForTeacher';
var response = await http.get(url, body: {
'teacherInitial': 'MAH',
'status' : {
'id': 1,
'nameOfFilesUploaded': 'Spring 2020 Version-2',
'statusOfPublish': true,
'timeOfUpload': '2020-01-23T23:27:22.8211125'
}
});
print('Response body: ${response.body}');
- Xamarin (RestSharp)
var client = new RestClient("https://routine-explorer.herokuapp.com/api/routine/GetScheduleForTeacher");
var request = new RestRequest(Method.POST);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("Connection", "keep-alive");
request.AddHeader("Content-Length", "211");
request.AddHeader("Accept-Encoding", "gzip, deflate");
request.AddHeader("Host", "localhost:5000");
request.AddHeader("Cache-Control", "no-cache");
request.AddHeader("Accept", "*/*");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\n\t\"TeacherInitial\": \"MAH\",\n\t\"status\" : {\n\t\t\t \"id\": 1,\n\t\t\t \"nameOfFilesUploaded\": \"Spring 2020 Version-2\",\n\t\t\t \"statusOfPublish\": true,\n\t\t\t \"timeOfUpload\": \"2020-01-23T23:27:22.8211125\"\n\t\t\t }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);