From dae836e49ba048e38cd3ffd8c03e67973b06690f Mon Sep 17 00:00:00 2001 From: Leo <95978312+yaefdb@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:51:51 +0800 Subject: [PATCH] update --- consumerWebsite/public/css/api.css | 106 +++- consumerWebsite/public/css/data.css | 59 ++ consumerWebsite/public/css/learnmore.css | 13 + consumerWebsite/public/js/apikey.js | 98 +++ consumerWebsite/public/js/data.js | 184 ++++++ consumerWebsite/public/js/learnmore.js | 35 +- consumerWebsite/routes/render.js | 5 + consumerWebsite/views/api.ejs | 770 ++++++++++++----------- consumerWebsite/views/bot.ejs | 3 + consumerWebsite/views/learnmore.ejs | 4 + consumerWebsite/views/test.html | 48 ++ consumerWebsite/views/viewdata.ejs | 43 ++ 12 files changed, 971 insertions(+), 397 deletions(-) create mode 100644 consumerWebsite/public/css/data.css create mode 100644 consumerWebsite/public/js/apikey.js create mode 100644 consumerWebsite/public/js/data.js create mode 100644 consumerWebsite/views/test.html create mode 100644 consumerWebsite/views/viewdata.ejs diff --git a/consumerWebsite/public/css/api.css b/consumerWebsite/public/css/api.css index f5d527e..ba1fa73 100644 --- a/consumerWebsite/public/css/api.css +++ b/consumerWebsite/public/css/api.css @@ -546,4 +546,108 @@ body.one-content-column-version .content thead { #content-get-api .generate-key-button:hover { background-color: #45a049; /* Darker green on hover */ -} \ No newline at end of file +} + +.delete-key-button { + float: right; /* Align the button to the right */ + margin-right: 78%; + margin-top: -40px; /* Adjust the margin-top value based on your layout */ + /* Add any additional styling you want for the button */ +} + +#content-get-api .delete-key-button { + background-color: #af4c4c; /* Green background color */ + color: white; /* White text color */ + padding: 5px 11px; /* Padding for the button */ + border: none; /* Remove button border */ + border-radius: 5px; /* Add border-radius for rounded corners */ + cursor: pointer; /* Add pointer cursor on hover */ + font-size: 14px; /* Font size */ +} + +#content-get-api .delete-key-button:hover { + background-color: #a04545; /* Darker green on hover */ +} + + +.generate-key-screen { + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + padding: 30px; + width: 400px; /* Adjust the width as needed */ + background-color: #ffffff; + border: 1px solid #eaeaea; + box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); /* Adjust the shadow as needed */ + z-index: 1000; + border-radius: 12px; /* Slightly increased border-radius for a softer look */ + overflow: hidden; /* Hide overflow content */ +} + +.generate-key-screen label { + display: block; + margin-bottom: 8px; + color: #333; +} + +.generate-key-screen input { + width: 100%; + padding: 8px; + margin-bottom: 16px; + box-sizing: border-box; + border: 1px solid #ccc; + border-radius: 4px; +} + +.generate-key-screen button { + background-color: #4caf50; + color: #fff; + padding: 10px 15px; + border: none; + border-radius: 4px; + cursor: pointer; + transition: background-color 0.3s ease; +} + +.generate-key-screen button:hover { + background-color: #45a049; +} + +.generate-key-screen button + button { + margin-left: 8px; + background-color: #f44336; +} + +.generate-key-screen button + button:hover { + background-color: #d32f2f; +} + +.key-input { + display: flex; + align-items: center; +} + +.key-input input { + flex: 1; + padding: 8px; + margin-right: 8px; + box-sizing: border-box; + border: 1px solid #ccc; + border-radius: 4px; +} + +.key-input button { + background-color: #4caf50; + color: #fff; + padding: 8px 12px; + border: none; + border-radius: 4px; + cursor: pointer; + transition: background-color 0.3s ease; +} + +.key-input button:hover { + background-color: #45a049; +} + diff --git a/consumerWebsite/public/css/data.css b/consumerWebsite/public/css/data.css new file mode 100644 index 0000000..8bac443 --- /dev/null +++ b/consumerWebsite/public/css/data.css @@ -0,0 +1,59 @@ +.air-quality-container { + display: flex; + flex-direction: column; + width: 800px; + /* Adjust width as needed */ + margin: 0 auto; + position: relative; +} + +.chart-container { + background-color: #f5f5f5; + padding: 20px; + position: relative; +} + +.button-container { + display: flex; + justify-content: space-between; + margin: 20px 0; +} + +#download-container { + display: flex; + align-items: center; + margin-top: 20px; /* Adjust the margin-top for spacing */ +} + +button { + border: 1px solid #ddd; + border-radius: 5px; + padding: 5px 10px; + font-size: 14px; + cursor: pointer; +} + +.data-table { + border-collapse: collapse; + width: 100%; +} + +.graphbutton-container { + display: flex; + justify-content: center; /* Center the buttons horizontally */ + margin: 20px 0; +} + +button#barButton, +button#lineButton { + border: 1px solid #ddd; + border-radius: 5px; + padding: 5px 10px; + font-size: 14px; + cursor: pointer; + margin: 0 10px; +} + + + + diff --git a/consumerWebsite/public/css/learnmore.css b/consumerWebsite/public/css/learnmore.css index 7d7589f..8293cae 100644 --- a/consumerWebsite/public/css/learnmore.css +++ b/consumerWebsite/public/css/learnmore.css @@ -100,3 +100,16 @@ body { background-color: #213f6d; color: #fff; } + +.custom-btn { + display: inline-block; + padding: 10px 20px; /* Adjust padding as needed */ + background-color: #3498db; /* Change background color */ + color: #ffffff; /* Change text color */ + text-decoration: none; + border-radius: 5px; /* Add rounded corners if desired */ +} + +.custom-btn:hover { + background-color: #2980b9; /* Change background color on hover */ +} diff --git a/consumerWebsite/public/js/apikey.js b/consumerWebsite/public/js/apikey.js new file mode 100644 index 0000000..fe1d021 --- /dev/null +++ b/consumerWebsite/public/js/apikey.js @@ -0,0 +1,98 @@ +function generateKey() { + // Create the overlay dynamically + var overlay = document.createElement('div'); + overlay.className = 'overlay'; + + // Create the small screen dynamically + var generateKeyScreen = document.createElement('div'); + generateKeyScreen.className = 'generate-key-screen'; + + // Generate random public and private keys + var publicKey = generateRandomKey(); + var privateKey = generateRandomKey(); + + // Add input fields for Name, Public Key, Private Key, Key Type, and Created + generateKeyScreen.innerHTML = ` + +
+ + + +
+ + + +
+ + +
+ + + + `; + + // Append the overlay and small screen to the body + document.body.appendChild(overlay); + document.body.appendChild(generateKeyScreen); + + // Display the overlay and small screen + overlay.style.display = 'block'; + generateKeyScreen.style.display = 'block'; +} + +function generateRandomKey() { + // Generate a random string as a key (you might want to use a more robust key generation method) + return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); +} + +function getCurrentDate() { + // Get the current date and format it as 'YYYY-MM-DD' + return new Date().toISOString().split('T')[0]; +} + +function copyToClipboard(elementId) { + // Copy the text from the specified input field to the clipboard + var element = document.getElementById(elementId); + element.select(); + document.execCommand('copy'); + + // Optionally, you can provide feedback to the user (e.g., display a tooltip) + alert('Copied to clipboard: ' + element.value); +} + + +function saveKey() { + // Retrieve values from input fields + var name = document.getElementById('name').value; + var publicKey = document.getElementById('publicKey').value; + var privateKey = document.getElementById('privateKey').value; + var created = document.getElementById('created').value; + + // Create a new table row with the key information + var newRow = document.createElement('tr'); + newRow.innerHTML = ` + ${name} + ${publicKey} + ${privateKey} + ${created} + `; + + // Append the new row to the table body + var tableBody = document.querySelector('#content-get-api tbody'); + tableBody.appendChild(newRow); + + // Optionally, you can close the small screen + closeGenerateKey(); +} + + +function closeGenerateKey() { + var overlay = document.querySelector('.overlay'); + var generateKeyScreen = document.querySelector('.generate-key-screen'); + + // Hide and remove the overlay and small screen from the DOM + overlay.style.display = 'none'; + generateKeyScreen.style.display = 'none'; + document.body.removeChild(overlay); + document.body.removeChild(generateKeyScreen); +} diff --git a/consumerWebsite/public/js/data.js b/consumerWebsite/public/js/data.js new file mode 100644 index 0000000..5d1b37f --- /dev/null +++ b/consumerWebsite/public/js/data.js @@ -0,0 +1,184 @@ +const buttons = document.querySelectorAll('.button-container button'); +const ctx = document.getElementById('dataChart').getContext('2d'); + +// Initial dataset (AQI) +const initialData = { + labels: ['', 'Jan 22 11:00 PM', '', '', 'Jan 23 2:00 AM', '', '', 'Jan 23 5:00 AM', '', '', 'Jan 23 8:00 AM', '',], + datasets: [{ + label: 'AQI', + data: [50, 60, 60, 80, 30, 60, 54, 60, 43, 30, 60, 60], + backgroundColor: 'green', + borderColor: 'green', + }] +}; + +const chart = new Chart(ctx, { + type: 'bar', + data: initialData, + options: { + responsive: true, + title: { + display: true, + text: 'HISTORICAL' + }, + subtitle: { + display: true, + text: 'Historic air quality graph for Singapore' + }, + legend: { + display: false + }, + tooltips: { + mode: 'index', + intersect: false, + callbacks: { + label: function (tooltipItem, data) { + const label = data.labels[tooltipItem.index]; + return label + ': ' + data.datasets[0].data[tooltipItem.index]; + } + } + }, + scales: { + xAxes: [{ + barPercentage: 0.6, + categoryPercentage: 0.7, + ticks: { + autoSkip: true, + }, + maxRotation: 0, + minRotation: 0 + }], + yAxes: [{ + title: { + display: true, + text: 'Value' + } + }] + } + } +}); + +// Function to update chart data based on the selected button +const updateChart = (data) => { + chart.data = data; + chart.update(); +}; + +// Event listener for button clicks +buttons.forEach(button => { + button.addEventListener('click', () => { + // Implement logic to switch data based on clicked button + const buttonId = button.id.toLowerCase(); + let newData; + + // Example: Switch data based on button clicked + switch (buttonId) { + case 'aqibutton': + newData = { + labels: ['', 'Jan 22 11:00 PM', '', '', 'Jan 23 2:00 AM', '', '', 'Jan 23 5:00 AM', '', '', 'Jan 23 8:00 AM', '',], + datasets: [{ + label: 'AQI', + data: [50, 60, 60, 80, 30, 60, 54, 60, 43, 30, 60, 60], + backgroundColor: 'green', + borderColor: 'green', + }] + }; + + break; + case 'tempbutton': + newData = { + labels: ['Jan 22 11:00 PM', 'Jan 23 12:00 AM', 'Jan 23 1:00 AM', 'Jan 23 2:00 AM'], + datasets: [{ + label: 'Temperature', + data: [25, 30, 40, 35], + backgroundColor: 'green', + borderColor: 'green', + }] + }; + break; + case 'humbutton': + newData = { + labels: ['Jan 22 11:00 PM', 'Jan 23 12:00 AM', 'Jan 23 1:00 AM', 'Jan 23 2:00 AM'], + datasets: [{ + label: 'Humidity', + data: [25, 30, 40, 35], + backgroundColor: 'green', + borderColor: 'green', + }] + }; + break; + case 'pm25button': + newData = { + labels: ['Jan 22 11:00 PM', 'Jan 23 12:00 AM', 'Jan 23 1:00 AM', 'Jan 23 2:00 AM'], + datasets: [{ + label: 'PM2.5', + data: [25, 30, 40, 35], + backgroundColor: 'green', + borderColor: 'green', + }] + }; + break; + case 'pm10button': + newData = { + labels: ['Jan 22 11:00 PM', 'Jan 23 12:00 AM', 'Jan 23 1:00 AM', 'Jan 23 2:00 AM'], + datasets: [{ + label: 'PM10', + data: [25, 30, 40, 35], + backgroundColor: 'green', + borderColor: 'green', + }] + }; + break; + case 'o3button': + newData = { + labels: ['Jan 22 11:00 PM', 'Jan 23 12:00 AM', 'Jan 23 1:00 AM', 'Jan 23 2:00 AM'], + datasets: [{ + label: 'O3', + data: [25, 30, 40, 35], + backgroundColor: 'green', + borderColor: 'green', + }] + }; + break; + case 'no2button': + newData = { + labels: ['Jan 22 11:00 PM', 'Jan 23 12:00 AM', 'Jan 23 1:00 AM', 'Jan 23 2:00 AM'], + datasets: [{ + label: 'NO2', + data: [25, 30, 40, 35], + backgroundColor: 'green', + borderColor: 'green', + }] + }; + break; + case 'so2button': + newData = { + labels: ['Jan 22 11:00 PM', 'Jan 23 12:00 AM', 'Jan 23 1:00 AM', 'Jan 23 2:00 AM'], + datasets: [{ + label: 'SO2', + data: [25, 30, 40, 35], + backgroundColor: 'green', + borderColor: 'green', + }] + }; + break; + case 'cobutton': + newData = { + labels: ['Jan 22 11:00 PM', 'Jan 23 12:00 AM', 'Jan 23 1:00 AM', 'Jan 23 2:00 AM'], + datasets: [{ + label: 'CO', + data: [25, 30, 40, 35], + backgroundColor: 'green', + borderColor: 'green', + }] + }; + break; + + default: + newData = initialData; // Default to initial data (AQI) + break; + } + + updateChart(newData); + }); +}); \ No newline at end of file diff --git a/consumerWebsite/public/js/learnmore.js b/consumerWebsite/public/js/learnmore.js index 2e4a440..a8948ee 100644 --- a/consumerWebsite/public/js/learnmore.js +++ b/consumerWebsite/public/js/learnmore.js @@ -1,21 +1,21 @@ document.addEventListener("DOMContentLoaded", function () { function updateAdditionalInfo(region) { const infoContainer = document.getElementById("additional-info"); -// Replace the following with actual data retrieval based on the region -const aqi = "15"; -const temperature = "25°C"; -const humidity = "60%"; -const pm25 = "10"; -const pm10 = "20"; -const so2 = "5"; -const o3 = "35"; -const co = "0.5"; -const no2 = "15"; + // Replace the following with actual data retrieval based on the region + const aqi = "15"; + const temperature = "25°C"; + const humidity = "60%"; + const pm25 = "10"; + const pm10 = "20"; + const so2 = "5"; + const o3 = "35"; + const co = "0.5"; + const no2 = "15"; -infoContainer.innerHTML = ` + infoContainer.innerHTML = `

Additional Information - ${region}

- +
Air Quality Index: ${aqi} @@ -54,7 +54,13 @@ infoContainer.innerHTML = `
`; + var viewDataButton = document.getElementById("viewData"); + // Add a click event listener to the button + viewDataButton.addEventListener("click", function () { + // Redirect to the "viewdata.ejs" page + window.location.href = "/viewdata"; + }); // Remove the 'active' class from all info-box elements const infoBoxes = document.querySelectorAll('.info-box'); @@ -65,12 +71,14 @@ infoContainer.innerHTML = ` clickedBox.classList.add('active'); } + + const defaultRegion = "North"; const defaultBox = document.getElementById(defaultRegion.toLowerCase()); defaultBox.classList.add('active'); const defaultAqi = "--"; // Replace with actual data retrieval updateAdditionalInfo(defaultRegion, defaultAqi); - + // Event listeners for each region's info-box document.getElementById("north").addEventListener("click", function () { const northAqi = "--"; // Replace with actual data retrieval @@ -117,3 +125,4 @@ document.getElementById("central").addEventListener("click", function () { updateAdditionalInfo("Central"); }); + diff --git a/consumerWebsite/routes/render.js b/consumerWebsite/routes/render.js index d347453..60eae5e 100644 --- a/consumerWebsite/routes/render.js +++ b/consumerWebsite/routes/render.js @@ -82,6 +82,11 @@ router.get("/contact", function (req, res, next) { res.render("contact"); }); +//data page +router.get("/viewdata", function (req, res, next) { + res.render("viewdata"); +}); + //api doc router.get("/api", function (req, res, next) { res.render("api"); diff --git a/consumerWebsite/views/api.ejs b/consumerWebsite/views/api.ejs index 73b6f6e..be8f73c 100644 --- a/consumerWebsite/views/api.ejs +++ b/consumerWebsite/views/api.ejs @@ -5,394 +5,398 @@ https://github.com/ticlekiwi/API-Documentation-HTML-Template !--> -<%- include('top') %> - + <%- include('top') %> + - -
- -
-
- - -
-
+ +
+ +
+
+ + +
+
-
-
-
-

Get started

-

- The following API is provided by the Eco saver developer team. It allows you to get Location and - Sensor and Sensor Data from the Eco saver database. -

-

- To use this API, you need an API key. -

-
-
-

Get all location

-

- To get Location of sensors you need to make a GET call to the following url :
- https://api.teeseng.uk/api/v0/location -
-
- Return Response :
- {"status":"200"} -

-
-

QUERY PARAMETERS

- - - - - - - - - - - - - - - - - -
FieldTypeDescription
AuthorizationJSONYour API key.(Required) Example: curl https://api.teeseng.uk/api/v0/location -H "Authorization: - {provide your - API key here}"
-
-
-

Get location by ID

-

- To get Location you need to make a GET call to the following url :
- https://api.teeseng.uk/api/v0/location/{id} -
-
- Return Response :
- {"status":"200"} -

-
-

QUERY PARAMETERS

- - - - - - - - - - - - - - - - - -
FieldTypeDescription
AuthorizationJSON(Required) Your API key.Example: curl https://api.teeseng.uk/api/v0/location -H "Authorization: {provide - your - API key here}"
-
-
-

Add Location (Only for system or admin API key)

-

- To add an Location you need to make a POST call to the following url :
- https://api.teeseng.uk/api/v0/location/new -
-
- Example :
- curl https://api.teeseng.uk/api/v0/location/new -H "Content-Type: application/json" -X POST -d '{"name": "SAMPLE", "added_by": "system" , "description": "test"}' -
-
- Return Response :
- {"status":"200"} -

-
-

QUERY PARAMETERS

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FieldTypeDescription
AuthorizationJSONYour API key.(Required) Example: curl https://api.teeseng.uk/api/v0/location/new -H - "Authorization: {provide your - API key here}"
Location nameJSONLocation name.(Required) Location name. Example: curl https://api.teeseng.uk/api/v0/location/new - -H "Authorization: provide - your API key here" -d '{"name":"Location name"}'
Added by JSONSystem or Admin(Required) System or Admin Example: curl https://api.teeseng.uk/api/v0/location/new - -H "Authorization: provide - your API key here" -d '{"added_by":"system"}'
DescriptionJSONDescription of Location(Required) System or Admin Example: curl https://api.teeseng.uk/api/v0/location/new - -H "Authorization: provide - your API key here" -d '{"description":"test"}'
-
- -
-

Update Location (Only for system or admin API key)

-

- To update an Location you need to make a PUT call to the following url :
- https://api.teeseng.uk/api/v0/location/update -
-
- Example :
- curl https://api.teeseng.uk/api/v0/location/update -H "Content-Type: application/json" -X POST -d '{"id": "7" , "name": "SAMPLE", "added_by": "system" , "description": "test"}' -
-
- Return Response :
- {"status":"200","message":"Location 7 updated"} -

-
-

QUERY PARAMETERS

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FieldTypeDescription
AuthorizationJSONYour API key.(Required) example: curl https://api.teeseng.uk/api/v0/location/update -H - "Authorization: {provide your - API key here}"
IDJSONLocation ID(Required) Location ID Example: curl https://api.teeseng.uk/api/v0/location/update - -H "Authorization: provide - your API key here" -d '{"id": "7"}'
Location nameJSONLocation name.(Optional) Location name. Example: curl https://api.teeseng.uk/api/v0/location/new - -H "Authorization: provide - your API key here" -d '{"name":"Location name"}'
Added by JSONSystem or Admin(Optional) System or Admin Example: curl https://api.teeseng.uk/api/v0/location/new - -H "Authorization: provide - your API key here" -d '{"added_by":"system"}'
DescriptionJSONDescription of Location(Optional) System or Admin Example: curl https://api.teeseng.uk/api/v0/location/new - -H "Authorization: provide - your API key here" -d '{"description":"test"}'
-
- -
-

Delete Location (Only for system or admin API key)

-

- To delete an Location you need to make a DELETE call to the following url :
- https://api.teeseng.uk/api/v0/location/delete -
-
- Example :
- curl https://api.teeseng.uk/api/v0/location/delete -H "Content-Type: application/json" -X POST -d '{"id": "7"}' -

-
-

QUERY PARAMETERS

- - - - - - - - - - - - - - - - - - - - - - - - -
FieldTypeDescription
AuthorizationJSONYour API key.(Required) example: curl https://api.teeseng.uk/api/v0/location/delete -H - "Authorization: {provide your - API key here}"
IDJSONLocation ID(Required) Location ID Example: curl https://api.teeseng.uk/api/v0/location/delete - -H "Authorization: provide - your API key here" -d '{"id": "7"}'
-
+
+
+
+

Get started

+

+ The following API is provided by the Eco saver developer team. It allows you to get Location and + Sensor and Sensor Data from the Eco saver database. +

+

+ To use this API, you need an API key. +

+
+
+

Get all location

+

+ To get Location of sensors you need to make a GET call to the following url :
+ https://api.teeseng.uk/api/v0/location +
+
+ Return Response :
+ {"status":"200"} +

+
+

QUERY PARAMETERS

+ + + + + + + + + + + + + + + + + +
FieldTypeDescription
AuthorizationJSONYour API key.(Required) Example: curl https://api.teeseng.uk/api/v0/location -H "Authorization: + {provide your + API key here}"
+
+
+

Get location by ID

+

+ To get Location you need to make a GET call to the following url :
+ https://api.teeseng.uk/api/v0/location/{id} +
+
+ Return Response :
+ {"status":"200"} +

+
+

QUERY PARAMETERS

+ + + + + + + + + + + + + + + + + +
FieldTypeDescription
AuthorizationJSON(Required) Your API key.Example: curl https://api.teeseng.uk/api/v0/location -H "Authorization: {provide + your + API key here}"
+
+
+

Add Location (Only for system or admin API key)

+

+ To add an Location you need to make a POST call to the following url :
+ https://api.teeseng.uk/api/v0/location/new +
+
+ Example :
+ curl https://api.teeseng.uk/api/v0/location/new -H "Content-Type: application/json" -X POST -d '{"name": "SAMPLE", "added_by": "system" , "description": "test"}' +
+
+ Return Response :
+ {"status":"200"} +

+
+

QUERY PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FieldTypeDescription
AuthorizationJSONYour API key.(Required) Example: curl https://api.teeseng.uk/api/v0/location/new -H + "Authorization: {provide your + API key here}"
Location nameJSONLocation name.(Required) Location name. Example: curl https://api.teeseng.uk/api/v0/location/new + -H "Authorization: provide + your API key here" -d '{"name":"Location name"}'
Added by JSONSystem or Admin(Required) System or Admin Example: curl https://api.teeseng.uk/api/v0/location/new + -H "Authorization: provide + your API key here" -d '{"added_by":"system"}'
DescriptionJSONDescription of Location(Required) System or Admin Example: curl https://api.teeseng.uk/api/v0/location/new + -H "Authorization: provide + your API key here" -d '{"description":"test"}'
+
+ +
+

Update Location (Only for system or admin API key)

+

+ To update an Location you need to make a PUT call to the following url :
+ https://api.teeseng.uk/api/v0/location/update +
+
+ Example :
+ curl https://api.teeseng.uk/api/v0/location/update -H "Content-Type: application/json" -X POST -d '{"id": "7" , "name": "SAMPLE", "added_by": "system" , "description": "test"}' +
+
+ Return Response :
+ {"status":"200","message":"Location 7 updated"} +

+
+

QUERY PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FieldTypeDescription
AuthorizationJSONYour API key.(Required) example: curl https://api.teeseng.uk/api/v0/location/update -H + "Authorization: {provide your + API key here}"
IDJSONLocation ID(Required) Location ID Example: curl https://api.teeseng.uk/api/v0/location/update + -H "Authorization: provide + your API key here" -d '{"id": "7"}'
Location nameJSONLocation name.(Optional) Location name. Example: curl https://api.teeseng.uk/api/v0/location/new + -H "Authorization: provide + your API key here" -d '{"name":"Location name"}'
Added by JSONSystem or Admin(Optional) System or Admin Example: curl https://api.teeseng.uk/api/v0/location/new + -H "Authorization: provide + your API key here" -d '{"added_by":"system"}'
DescriptionJSONDescription of Location(Optional) System or Admin Example: curl https://api.teeseng.uk/api/v0/location/new + -H "Authorization: provide + your API key here" -d '{"description":"test"}'
+
+ +
+

Delete Location (Only for system or admin API key)

+

+ To delete an Location you need to make a DELETE call to the following url :
+ https://api.teeseng.uk/api/v0/location/delete +
+
+ Example :
+ curl https://api.teeseng.uk/api/v0/location/delete -H "Content-Type: application/json" -X POST -d '{"id": "7"}' +

+
+

QUERY PARAMETERS

+ + + + + + + + + + + + + + + + + + + + + + + + +
FieldTypeDescription
AuthorizationJSONYour API key.(Required) example: curl https://api.teeseng.uk/api/v0/location/delete -H + "Authorization: {provide your + API key here}"
IDJSONLocation ID(Required) Location ID Example: curl https://api.teeseng.uk/api/v0/location/delete + -H "Authorization: provide + your API key here" -d '{"id": "7"}'
+
-
-

Errors

-

- The Westeros API uses the following error codes: -

- - - - - - - - - - - - - - - - - - - - - - - - - -
Error CodeMeaning
X000 - Some parameters are missing. This error appears when you don't pass every mandatory - parameters. -
403 - Unknown or unvalid secret_key. This error appears if - you use an unknow API key or if your API key expired. -
500 - Unvalid secret_key No API key was supplied. Invalid - request. -
X003 - Unknown or unvalid user token. This error appears if - you use an unknow user token or if the user token expired. -
-
-
-
-

API Keys

- -

- You can generate API Keys here: -

- - - - - - - - - - - - - - - - - - - -
NamePublic KeyPrivate KeyKey TypeCreated
API KeyGR234-We34greR-234-fEGType2024-01-22
+
+

Errors

+

+ The Westeros API uses the following error codes: +

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Error CodeMeaning
X000 + Some parameters are missing. This error appears when you don't pass every mandatory + parameters. +
403 + Unknown or unvalid secret_key. This error appears if + you use an unknow API key or if your API key expired. +
500 + Unvalid secret_key No API key was supplied. Invalid + request. +
X003 + Unknown or unvalid user token. This error appears if + you use an unknow user token or if the user token expired. +
+
+
+
+

API Keys

+
+ +
+

+ You can generate API Keys here: +

+ + + + + + + + + + + + + + + + + +
NamePublic KeyPrivate KeyCreated
API KeyGR234-We34greR-234-fEG2024-01-22
- - -
-
- - - + + + +
+
+ + + + + + diff --git a/consumerWebsite/views/bot.ejs b/consumerWebsite/views/bot.ejs index c383677..965a65c 100644 --- a/consumerWebsite/views/bot.ejs +++ b/consumerWebsite/views/bot.ejs @@ -82,6 +82,9 @@
+ + + \ No newline at end of file diff --git a/consumerWebsite/views/learnmore.ejs b/consumerWebsite/views/learnmore.ejs index 5ef406f..939715f 100644 --- a/consumerWebsite/views/learnmore.ejs +++ b/consumerWebsite/views/learnmore.ejs @@ -38,7 +38,11 @@

+ + + + <%- include('bot') %> diff --git a/consumerWebsite/views/test.html b/consumerWebsite/views/test.html new file mode 100644 index 0000000..3318de7 --- /dev/null +++ b/consumerWebsite/views/test.html @@ -0,0 +1,48 @@ + + + + + + PM2.5 Sub-Index Over Time + + + + + + + + \ No newline at end of file diff --git a/consumerWebsite/views/viewdata.ejs b/consumerWebsite/views/viewdata.ejs new file mode 100644 index 0000000..7e14ccb --- /dev/null +++ b/consumerWebsite/views/viewdata.ejs @@ -0,0 +1,43 @@ +<%- include('top') %> + + + +
+
+
+ + + +
+ <%# +
+ + +
%> +
+ +
+
+ + + + + + + + + +
+
+

Download data here:

+ +
+
+ + + + +
+
+ +<%- include('bot') %> \ No newline at end of file