add shields mood endpoint

This commit is contained in:
emilyd 2022-11-26 10:40:46 +02:00
parent c445b988e8
commit 631dcfde48
2 changed files with 20 additions and 1 deletions

View File

@ -5,7 +5,8 @@
</div> </div>
<div class='window-content'> <div class='window-content'>
<ul> <ul>
<li><a href="shields-posts.php">shields posts endpoint</a></li> <li><a href="shields-posts.php">shields.io posts endpoint</a></li>
<li><a href="shields-mood.php">shields.io mood endpoint</a></li>
</ul> </ul>
</div> </div>
</div> </div>

18
api/shields-mood.php Normal file
View File

@ -0,0 +1,18 @@
<?php
header('Content-Type: application/json');
require "../templates/config.php";
?>
{
"schemaVersion": 1,
"label": "current mood",
"color": "lightgrey",
<?php
require "../creds.php";
$result = mysqli_query($mysqli, "SELECT Mood FROM articles ORDER BY ID DESC LIMIT 1");
while($res = mysqli_fetch_array($result)) {
echo ' "message": "'.$res['Mood'].'"',"\n";
}
?>
}