GabriM97 / RadioApp-APIs

Symfony APIs Application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Radio App

Build and Run the application

Requirements

Start the application

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.

Application Endpoints

Following are some example requests for the available endpoints.

Webhook

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.

Episode

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 title
  • topic (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 days
  • from_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 the last_days field when to_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 the last_days field when from_date is not set.

About

Symfony APIs Application


Languages

Language:PHP 98.5%Language:Dockerfile 1.5%