APIs

Utils

GET /latest/token

Login to KUAS, and return token for KUAS API.

Request Headers:
 
Response JSON Object:
 
  • duration (int) – The duration of this token to expired.
  • token_type (string) – Token type of this token.
  • gauth_token (strin) – Auth token.
Status Codes:

Request:

GET /latest/token HTTP/1.1
Host: kuas.grd.idv.tw:14769
Authorization: Basic xxxxxxxxxxxxx=
Accept: */*
curl -X GET -u username:password https://kuas.grd.idv.tw:14769/v2/token

Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "duration": 3600,
  "token_type": "Basic",
  "auth_token": "adfakdflakds.fladkjflakjdf.adslkfakdadf"
}
GET /latest/versions/(string: device_type)

Get latest version for app on (device_type) in webstore.

Parameters:
  • device_type – device we support
Response JSON Object:
 
  • version – Object of version (see below)

The versions version is a json object list below.

JSON Parameters:
 
  • device (string) – query device.
  • version (string) – latest version for device.

Request

GET /latest/versions/android HTTP/1.1
Host: kuas.grd.idv.tw:14769
curl -X GET https://kuas.grd.idv.tw:14769/v2/versions/android

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "version": {
    "device": "android",
    "version": "1.5.4"
  }
}
GET /latest/servers/status

Get KUAS API status for service

Response JSON Object:
 
  • status (list) – Status list (see below)

Servers status list

JSON Parameters:
 
  • service – service name.
  • status – HTTP status code.

Request

GET /v2/servers/status HTTP/1.1
Host: kuas.grd.idv.tw:14769
curl -X GET https://kuas.grd.idv.tw:14769/v2/servers/status

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "status": [
    {
      "service": "ap",
      "status": 200
    },
    {
      "service": "bus",
      "status": 200
    },
    {
      "service": "leave",
      "status": 200
    }
  ]
}

Bus

GET /latest/bus/timetables

Get KUAS school bus time table.

Query Parameters:
 
  • date (string) – Specific date to query timetable. format: yyyy-mm-dd
  • from (string) – The start station you want to query. (not impl yet)
Status Codes:

Requires authentication?

Yes

Request

without date (default the date on server)

GET /latest/bus/timetables HTTP/1.1
Host: kuas.grd.idv.tw:14769
Authorization: Basic xxxxxxxxxxxxx=
curl -i -X GET localhost:8001/v2/bus/timetables

with date

GET /latest/bus/timetables?date=2015-9-1 HTTP/1.1
Host: kuas.grd.idv.tw:14769
Authorization: Basic xxxxxxxxxxxxx=

Response

HTTP/1.0 200 OK
Content-Type: application/json

{
  "timetable":[
    {
      "endStation":"燕巢",
      "EndEnrollDateTime":"2015-08-31 17:20",
      "isReserve":-1,
      "Time":"08:20",
      "busId":"27034",
      "limitCount":"999",
      "reserveCount":"27",
      "runDateTime":"2015-09-01 08:20"
    },
    {
      "endStation":"燕巢",
      "EndEnrollDateTime":"2015-09-01 08:00",
      "isReserve":-1,
      "Time":"13:00",
      "busId":"27062",
      "limitCount":"999",
      "reserveCount":"1",
      "runDateTime":"2015-09-01 13:00"
    },
    {
      "endStation":"建工",
      "EndEnrollDateTime":"2015-09-01 07:15",
      "isReserve":-1,
      "Time":"12:15",
      "busId":"27090",
      "limitCount":"999",
      "reserveCount":"5",
      "runDateTime":"2015-09-01 12:15"
    },
    {
      "endStation":"建工",
      "EndEnrollDateTime":"2015-09-01 11:45",
      "isReserve":-1,
      "Time":"16:45",
      "busId":"27118",
      "limitCount":"999",
      "reserveCount":"24",
      "runDateTime":"2015-09-01 16:45"
    }
  ],
  "date":"2015-9-1"
}
PUT /latest/bus/reservations/(int: bus_id)
GET /bus/reservations

Get user’s bus reservation.

Requires authentication?

Yes

Request

Response

PUT /bus/reservations

put

DELETE /bus/reservations

delete

GET /latest/bus/reservations
GET /bus/reservations

Get user’s bus reservation.

Requires authentication?

Yes

Request

Response

PUT /bus/reservations

put

DELETE /bus/reservations

delete

DELETE /latest/bus/reservations/(string: end_time)
GET /bus/reservations

Get user’s bus reservation.

Requires authentication?

Yes

Request

Response

PUT /bus/reservations

put

DELETE /bus/reservations

delete

Notifications

GET /latest/notifications/(int: page)

Get KUAS notification

Parameters:
  • page (int) – specific page for notifications

Request

GET /v2/notifications/1 HTTP/1.1
Host: https://kuas.grd.idv.tw:14769/v2/notifications/1
curl -X GET https://kuas.grd.idv.tw:14769/v2/notifications/1

Response

HTTP/1.0 200 OK
Content-Type: application/json


{
  "page":1,
  "notification":[
    {
      "link":"http://student.kuas.edu.tw/files/13-1002-45032-1.php",
      "info":{
        "title":"『鄭豐喜國外深造獎助學金』104年度申請辦法公告",
        "date":"2015-09-04 ",
        "id":"1",
        "department":"諮商輔導中心"
      }
    },
    {
      "link":"http://gender.kuas.edu.tw/files/13-1005-45026-1.php",
      "info":{
        "title":"轉知社團法人台灣愛之希望協會辦理-104年同志公民運動系列活動,歡迎踴躍參加。",
        "date":"2015-09-04 ",
        "id":"2",
        "department":"性別平等專區"
      }
    },
    {},
    {}
  ]
}