- PHP 8.1 (temporary)
- Docker (and docker compose). Get Docker here.
- Composer (temporary). Get Composer here.
The application will run on localhost:8080
. You can change the port number from the docker-file.yaml
file.
Run the following commands from the root of the project:
> composer install
> docker compose -f setup/docker-compose.yaml up --build
> php bin/console doctrine:migrations:migrate --no-interaction
Go to http://localhost:8080 to access the homepage.
Following are some example requests for the available endpoints.
POST /webhook Webhooks entrypoint. Its behavior changes based on the event type passed.
{
"type": "event.name", // e.g. "episode.downloaded"
"event_id": "uuid",
"occurred_at": "ISO8601 date time",
"data": {
// e.g. payload for the "episode.downloaded" event
"episode_id": "uuid",
"podcast_id": "uuid"
}
}
type
(string) can be one of the following event types:episode.downloaded
, ... more coming in the future.event_id
(uuid) the unique identifier of the event.occurred_at
(datetime) the time when the event happened in a ISO8601 date time format (e.g.2022-11-15T18:10:34+0100
).data
(object) the JSON object containing the actual event data.
POST /api/episode/create Allows to create a new Episode. The response will contain the ID of the episode.
{
"title": "Episode Title",
"topic": "Episode Topic",
}
title
(string) the episode titletopic
(string) the topic of the episode.
GET /api/episode/{id}/stats Allows to retrieve stats (currently only the amount of downloads per day) for a specified Episode.
Required:
id
(int) the ID of the Episode you want to get stats for.
Optional query parameters:
last_days
(?int) allows to retrieve stats for the last X days. Default:7
daysfrom_date
(?datetime) a ISO8601 date. If set, the endpoint will return the episode stats starting from the passed date. This field is used in combination with thelast_days
field whento_date
is not set.to_date
(?datetime) a ISO8601 date. If set, the endpoint will return the episode stats up to the passed date. This field is used in combination with thelast_days
field whenfrom_date
is not set.