Skip to content

Database API

Henriette Steenhoff edited this page Feb 14, 2019 · 14 revisions

Database

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.

API

Created on the server hosted by DTU Byg.

Base URL: http://localhost/ClimAppAPI/v1/ClimAppApi.php

URL Method Parameter(s)
http://localhost/ClimAppAPI/v1/ClimAppApi.php?apicall=createUserRecord POST _id, age, gender, height, weight, unit
http://localhost/ClimAppAPI/v1/ClimAppApi.php?apicall=getUsers GET
http://localhost/ClimAppAPI/v1/ClimAppApi.php?apicall=updateUser POST _id, age, gender, height, weight, unit
http://localhost/ClimAppAPI/v1/ClimAppApi.php?apicall=updateUserAge POST _id, age
http://localhost/ClimAppAPI/v1/ClimAppApi.php?apicall=updateUserGender POST _id, gender
http://localhost/ClimAppAPI/v1/ClimAppApi.php?apicall=updateUserHeight POST _id, height
http://localhost/ClimAppAPI/v1/ClimAppApi.php?apicall=updateUserWeight POST _id, weight
http://localhost/ClimAppAPI/v1/ClimAppApi.php?apicall=deleteUser&_id= userId GET _id
http://localhost/ClimAppAPI/v1/ClimAppApi.php?apicall=addWeatherInformation POST _id, longitude, latitude, temperature, wind_speed, humidity, cloudiness, activity_level
http://localhost/ClimAppAPI/v1/ClimAppApi.php?apicall=getWeather GET
http://localhost/ClimAppAPI/v1/ClimAppApi.php?apicall=createFeedbackRecord POST user_id, type, rating, txt
http://localhost/ClimAppAPI/v1/ClimAppApi.php?apicall=getFeedback GET

Localhost will of course be substituted with the global IP address of the server.

Clone this wiki locally