tugberkozkara / Songs-I-Like-API

A simple REST API that provides the songs I like :)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Songs I Like API

Developed to mess around with APIs and songs that I like.

https://songs-i-like.herokuapp.com/

FastAPI, Postgres are used.



Example project:

listen-this-today.herokuapp.com



Endpoints

Can be viewed in /docs

GET /api/songs

Brings all songs saved.

Curl

curl -X 'GET' \
  'https://songs-i-like.herokuapp.com/api/songs' \
  -H 'accept: application/json'

Example response: 200 OK

[
    {
        "id":1,
        "artistName":"Men I Trust",
        "songName":"Lauren"
    },
    {
        "id":2,
        "artistName":"Tame Impala",
        "songName":"The Less I Know the Better"
    },
    ...
]



POST /api/songs

Adds a new song.

Example request body:

{
  "artistName": "Mor ve Otesi",
  "songName": "Bazen"
}

Then response: 201 Created

{
  "id": 57,
  "artistName": "Mor ve Otesi",
  "songName": "Bazen"
}



PUT /api/songs/{song_id}

Updates a song with id.

Example request body:

PUT /api/song/57
{
  "artistName": "Mor ve Otesi",
  "songName": "Gul Kendine"
}

Then response: 200

{
  "id": 57,
  "artistName": "Mor ve Otesi",
  "songName": "Gul Kendine"
}



DELETE /api/songs/{song_id}

Deletes a song with id.

Example request:

curl -X 'DELETE' \
  'https://songs-i-like.herokuapp.com/api/song/57' \
  -H 'accept: application/json'

Then response: 200

{
  "artistName": "Mor ve Otesi",
  "songName": "Gul Kendine",
  "id": 57
}

About

A simple REST API that provides the songs I like :)

License:MIT License


Languages

Language:Python 100.0%