Skip to content

Database API

Henriette Steenhoff edited this page Jul 3, 2019 · 14 revisions

Database server setup

The overall setup on the server looks similar to this (fetched from this website: https://www.simplifiedcoding.net/android-mysql-tutorial-to-perform-basic-crud-operation/

The mobile application sends an HTTP request to the server through the PHP API. If the request is a valid API request the data is either stored or retrieved from the database.

Changes

When changing database structure or API remember the dependencies to the PHP API and the code of the devices using it.

Code:

  • Database (on server)
  • Java API string (and related classes that implement URL, any or all of these)
  • PHP code (on server)
    • ClimAppAPI.php (create new version)
    • DbOperation.php

Documentation:

API

Created on the server hosted by DTU Byg. All parameters are shared preferences, each parameter links to the related preference description.

Base URL: https://climapp.byg.dtu.dk/ClimAppAPI/v1/ClimAppApi.php

URL Method Parameter(s)
https://climapp.byg.dtu.dk/ClimAppAPI/v1/ClimAppApi.php?apicall=createUserRecord POST _id, age, gender, height, weight, unit
https://climapp.byg.dtu.dk/ClimAppAPI/v1/ClimAppApi.php?apicall=getUsers GET
https://climapp.byg.dtu.dk/ClimAppAPI/v1/ClimAppApi.php?apicall=updateUser POST _id, age, gender, height, weight, unit
https://climapp.byg.dtu.dk/ClimAppAPI/v1/ClimAppApi.php?apicall=updateUserAge POST _id, age
https://climapp.byg.dtu.dk/ClimAppAPI/v1/ClimAppApi.php?apicall=updateUserGender POST _id, gender
https://climapp.byg.dtu.dk/ClimAppAPI/v1/ClimAppApi.php?apicall=updateUserHeight POST _id, height
https://climapp.byg.dtu.dk/ClimAppAPI/v1/ClimAppApi.php?apicall=updateUserWeight POST _id, weight
https://climapp.byg.dtu.dk/ClimAppAPI/v1/ClimAppApi.php?apicall=deleteUser&_id= userId GET _id
https://climapp.byg.dtu.dk/ClimAppAPI/v1/ClimAppApi.php?apicall=createWeatherRecord POST _id, longitude, latitude, city, temperature, wind_speed, humidity, cloudiness, activity_level, acclimatization, temp_min, temp_max
https://climapp.byg.dtu.dk/ClimAppAPI/v1/ClimAppApi.php?apicall=getWeather GET
https://climapp.byg.dtu.dk/ClimAppAPI/v1/ClimAppApi.php?apicall=createFeedbackRecord POST user_id, question_combo_id, rating1, rating2, rating3, txt
https://climapp.byg.dtu.dk/ClimAppAPI/v1/ClimAppApi.php?apicall=getFeedback GET

Localhost has been replaced by the DNS provided by DTU Byg IT.

Clone this wiki locally