This is a simple open REST API for immaginary ancient greece athletes. It was written for the third mini homework of the Web Programming M-Z @ DIEEI course.
All the endpoints use the GET
method.
Return information about the API.
For example, curl -s http://<URL of the athletes API>/ | jq
:
{
"description": "A simple open REST API for athletes!",
"version": "0.1"
}
Return the alphabetically ordered list of athletes.
For example, curl -s http://<URL of the athletes API>/athletes | jq
:
[
{
"slug": "arrhichione-di-fliunte",
"name": "Arrhichione di Fliunte",
"gender": "M",
"age": 26,
"sport": "Lotta",
"famous_for": "Conosciuto per il suo successo nella lotta e il suo sacrificio durante una competizione."
},
{
"slug": "astioco-di-taranto",
"name": "Astioco di Taranto",
"gender": "M",
"age": 25,
"sport": "Lotta",
"famous_for": "Conosciuto per la sua forza e abilità nella lotta."
},
{
"slug": "callias-di-atene",
"name": "Callias di Atene",
"gender": "M",
"age": 24,
"sport": "Danza",
"famous_for": "Rinomato per la sua destrezza nella danza."
},
{
"slug": "chryseis-di-larissa",
"name": "Chryseis di Larissa",
"gender": "F",
"age": 24,
"sport": "Lancio del giavellotto",
"famous_for": "Famosa per la sua agilità e velocità nel lancio del giavellotto."
},
MORE ENTRIES...
]
Return the specified athlete.
For example, curl -s http://<URL of the athletes API>/athletes/theodora-di-creta | jq
:
{
"slug": "theodora-di-creta",
"name": "Theodora di Creta",
"gender": "F",
"age": 26,
"sport": "Lancio del disco",
"famous_for": "Famosa per la sua abilità nel lancio del disco."
}
Search for athletes by name
, sport
or famous_for
. You have to pass
them as query params.
For example, curl -s http://<URL of the athletes API>/search\?sport\=salto | jq
:
[
{
"slug": "thalia-di-mileto",
"name": "Thalia di Mileto",
"gender": "F",
"age": 25,
"sport": "Salto in lungo",
"famous_for": "Famosa per la sua destrezza nel salto in lungo."
}
]
Return a picture of the athlete. You can specify size=M
or size=S
as query params to alter picture size.
Note
All the pictures where generated locally using Stable Diffusion XL.
For example, curl -s http://<URL of the athletes API>/images/eurydice-di-corinto\?size\=M | feh -
will show:
Return a random athlete.
For example, curl -s http://localhost:8080/random | jq
:
{
"slug": "diagora-di-rodi",
"name": "Diagora di Rodi",
"gender": "M",
"age": 32,
"sport": "Pugilato",
"famous_for": "Celebre per il suo successo nel pugilato."
}
Suppose you want to use the latest tag.
podman run -p 8080:8080 quay.io/eriol/wp24-athletes:latest