Skip to content
This repository has been archived by the owner on Dec 5, 2018. It is now read-only.

building4theweb/soundem-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

soundem-api Deploy

Running Locally

Install requirements

$ pip install -r requirements.txt

Create .env

Create a .env in the root of the project based on sample.env.

Populate database with sample fixture

$ python manage.py populate_db

Run development server

$ python manage.py runserver

Endpoints

Deployed to https://soundem-api.herokuapp.com

POST /api/v1/register

Request

{
  "email": "[email protected]",
  "password": "abc123"
}

Response

{
  "user": {
    "email": "[email protected]",
    "id": 1,
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MX0.G01VbljXYZa-Cfd-HveE4U0mHGFLrgo36M838S3K5RE"
  }
}

POST /api/v1/login

Request

{
  "email": "[email protected]",
  "password": "abc123"
}

Response

{
  "user": {
    "email": "[email protected]",
    "id": 1,
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MX0.G01VbljXYZa-Cfd-HveE4U0mHGFLrgo36M838S3K5RE"
  }
}

GET /api/v1/artists

Response

{
  "artists": [
    {
      "albums": [
        1
      ],
      "bio": "",
      "id": 1,
      "name": "Lana del Rey"
    },
    {
      "albums": [
        2
      ],
      "bio": "",
      "id": 2,
      "name": "AJ Davila"
    }
  ]
}

GET /api/v1/albums

Response

{
  "albums": [
    {
      "id": 1,
      "name": "Ultraviolence",
      "songs": [
        1,
        2,
        3
      ]
    },
    {
      "id": 2,
      "name": "Terror Amor",
      "songs": [
        4,
        5
      ]
    }
  ]
}

GET /api/v1/songs

Response

{
  "songs": [
    {
      "album": 1,
      "favorite": false,
      "id": 1,
      "name": "Pretty When You Cry"
    },
    {
      "album": 1,
      "favorite": false,
      "id": 2,
      "name": "Money Power Glory"
    },
    {
      "album": 1,
      "favorite": false,
      "id": 3,
      "name": "West Coast"
    },
    {
      "album": 2,
      "favorite": false,
      "id": 4,
      "name": "Animal"
    },
    {
      "album": 2,
      "favorite": false,
      "id": 5,
      "name": "Dura Como Piedra"
    }
  ]
}

PUT /api/v1/songs/:id/favorite

Response

{
  "song": {
    "album": 1,
    "favorite": true,
    "id": 1,
    "name": "Pretty When You Cry"
  }
}

About

RESTful API for demo application developed at BFTW

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages