smartccampus

smartcampus is a simple API allowing smartcampus mobile application to update the informations.

Resource Group

signup an user

POST https://smartcampus.csie.ncku.edu.tw/smart_campus/signup
Requestsexample 1
Headers
Content-Type: multipart/form-data, boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Length: $requestlen
Body
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="email"

$email
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="password"

$password
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="nickname"

$nickname
------WebKitFormBoundary7MA4YWxkTrZu0gW--
Responses201400400400
Headers
Content-Type: text/plain
Body
Registration succeeded!
Headers
Content-Type: text/plain
Body
Invalid email address.
Headers
Content-Type: text/plain
Body
Either email or password input is missing.
Headers
Content-Type: text/plain
Body
The email is already taken, try another!

signup
POST/signup


login as an user

POST https://smartcampus.csie.ncku.edu.tw/smart_campus/login
Requestsexample 1
Headers
Content-Type: multipart/form-data, boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Length: $requestlen
Body
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="email"

$email
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="password"

$password
------WebKitFormBoundary7MA4YWxkTrZu0gW
Responses200401
Headers
Content-Type: application/json
Body
{
    'message': 'Login succeeded',
    'data' : {
        'nickname': $nickname,
        'experience_point': $experience_point,
        'coins': $earned_coins,
        'reward': $reward.id,
        'favorite_stations': $station.id
    }
}
Headers
Content-Type: text/plain
Body
Login failed

login
POST/login


logout

POST https://smartcampus.csie.ncku.edu.tw/smart_campus/logout
Requestsexample 1
Headers
Content-Type: multipart/form-data, boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Length: $requestlen
Body
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="email"

$email
------WebKitFormBoundary7MA4YWxkTrZu0gW
Responses200404
Headers
Content-Type: text/plain
Body
Logout succeeded
Headers
Content-Type: text/plain
Body
User does not exist

logout
POST/logout


Get all rewards

GET https://smartcampus.csie.ncku.edu.tw/smart_campus/get_all_rewards
Responses200
Headers
Content-Type: application/json
Body
{
    {
        'id': $rewward.id,
        'name': $reward.name,
        'image_url': $url
    }, {
        'id': $rewward.id,
        'name': $reward.name,
        'image_url': $url
    }, ...
}

get_all_rewards
GET/get_all_rewards


Get all stations

GET https://smartcampus.csie.ncku.edu.tw/smart_campus/get_all_stations
Responses200
Headers
Content-Type: application/json
Body
{
    'id': $station.id,
    'name': $statione.name,
    'content': $station.content,
    'category' $station.category,
    'location': $station.location,
    'rewards': list of reward.id
    'image': {
        'primary': url,
        'others': list of the other image url
    }
}

get_all_stations
GET/get_all_stations


Get linked stations of specific beacon

POST https://smartcampus.csie.ncku.edu.tw/smart_campus/get_linked_stations
Requestsexample 1
Headers
Content-Type: multipart/form-data, boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Length: $requestlen
Body
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="beacon_id"

$beacon_id
------WebKitFormBoundary7MA4YWxkTrZu0gW
Responses200404
Headers
Content-Type: application/json
Body
{
    list of station.id
}
Headers
Content-Type: text/plain
Body
No match station

get_linked_stations
POST/get_linked_stations


Update user's coin

POST https://smartcampus.csie.ncku.edu.tw/smart_campus/update_user_coin
Requestsexample 1
Headers
Content-Type: multipart/form-data, boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Length: $requestlen
Body
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="coins"

$coins
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="email"

$email
------WebKitFormBoundary7MA4YWxkTrZu0gW
Responses404400200
Headers
Content-Type: text/plain
Body
Either user does not exist or coins input is not given
Headers
Content-Type: text/plain
Body
Invalid input of coins
Headers
Content-Type: application/json
Body
{
    'message':  'Coins record of {0} update succeed',
    'data': {
        'coins': $user.earned_coins
    }
}

update_user_coin
POST/update_user_coin


Update user's experience point

POST https://smartcampus.csie.ncku.edu.tw/smart_campus/update_user_experience_point
Requestsexample 1
Headers
Content-Type: multipart/form-data, boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Length: $requestlen
Body
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="experience_point"

$experience_point
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="email"

$email
------WebKitFormBoundary7MA4YWxkTrZu0gW
Responses404400200
Headers
Content-Type: text/plain
Body
Either user does not exist or experience_point input is not given
Headers
Content-Type: text/plain
Body
Invalid input of experience point
Headers
Content-Type: application/json
Body
{
    'message': 'Experience point record of {0} update succeed',
    'data': {
        'experience_point': $user.experience_point
    }
}

update_user_experience_point
POST/update_user_experience_point


Add a reward to user

POST https://smartcampus.csie.ncku.edu.tw/smart_campus/add_user_reward
Requestsexample 1
Headers
Content-Type: multipart/form-data, boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Length: $requestlen
Body
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="email"

$email
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="reward_id"

$reward_id
------WebKitFormBoundary7MA4YWxkTrZu0gW
Responses404400200
Headers
Content-Type: text/plain
Body
Either user or reward does not exist.
Headers
Content-Type: text/plain
Body
Add user reward failed.
Headers
Content-Type: text/plain
Body
Create Succeeded

add_user_reward
POST/add_user_reward


Add a station to user's favorite stations list

POST https://smartcampus.csie.ncku.edu.tw/smart_campus/add_user_favorite_stations
Requestsexample 1
Headers
Content-Type: multipart/form-data, boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Length: $requestlen
Body
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="station_id"

$station_id
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="email"

$email
------WebKitFormBoundary7MA4YWxkTrZu0gW
Responses404200
Headers
Content-Type: text/plain
Body
Either user or station does not exist
Headers
Content-Type: application/json
Body
{
    'message': 'Favorite stations update succeed',
    'stations': list of station.id
}

add_user_favorite_stations
POST/add_user_favorite_stations


Remove a station from user's favorite stations list

POST https://smartcampus.csie.ncku.edu.tw/smart_campus/remove_user_favorite_stations
Requestsexample 1
Headers
Content-Type: multipart/form-data, boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Length: $requestlen
Body
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="station_id"

$station_id
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="email"

$email
------WebKitFormBoundary7MA4YWxkTrZu0gW
Responses404200
Headers
Content-Type: text/plain
Body
Either user or station does not exist
Headers
Content-Type: application/json
Body
{
    'message': 'Favorite stations update succeed',
    'stations': list of station.id
}

remove_user_favorite_stations
POST/remove_user_favorite_stations


Generated by aglio on 07 Oct 2017