Skip to content

A Restful API to fetch and input data about Songs. Built with .NET 5.0 and C#.

Notifications You must be signed in to change notification settings

luizfelipers19/musicAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation


Logo

MusicAPI

An API to create and fetch data from your favorite songs!
Explore the docs »

Live API root · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact

About The Project

image

This project was built as a second step towards learning and demistifying how the Backend works behind the curtains in a RESTful architecture. This API only accepts GET and POST requests and has no authentication, so everyone that comes across this, can simply test it's usability and get a better understanding of the RESTful infrastructure. Well, as I said, the API only accepts GET and POST methods, so it's just a CR of a CRUD application. The reason: I don't want people deleting and updating the data that's already been added.

Here's why:

  • RESTful API's are everywhere. Learning how they work will mostly help you to get a better grip on modern architectures
  • Applications nowadays are split up in 2 or more sides, but mainly into the FrontEnd side and the Backend side. With this repo you can get a first step in understanding the Backend side by making simple requests to the API.
  • The API was deployed to Microsoft Azure servers, and will be available to everyone to send requests.

My only request to everyone that finds this is not to bomb the API with requests!! This was built with love and it shouldn't be taken away.

Built With

This project was built using the following technologies

Getting Started

To run this application, follow the steps listed below:

Prerequisites

You firstly need to have Visual Studio with .NET 5.0 framework installed in your machine.

Installation

If you want to reproduce this application, learn how it was coded and take it further for yourself, you can follow the steps below to reach your goals. I won't teach how to make the integration with Microsoft Azure at this point, but maybe in one of my next projects.

  1. Clone the repo
    git clone https://github.com/luizfelipers19/musicAPI.git
  2. Install all these dependencies and packages through NuGet Package Manager

image

  1. Create the localDB by typing the commands:
  • Add-Migration InitialMigration

  • Update-Database

  1. Compile and try running the application via IIS Express.

Usage

First I would like to state that the Connection Strings and ContainersNames were used as placeholders for this project, and are already updated in the deployed version. You can try using those credentials, but they are no longer available, as I've generated new ones to the definitive version.

This section introduces the application usage steps. For this, I'm using Swagger documentation printscreens. To use the application, you don't need to install it, because it runs inside Microsoft Azure servers and it's currently online.

As I've already mentioned. This application only accepts GET(read methods) and POST(create methods) Methods.

Project structure

This project is organized in 3 Model Classes: Artists, Albums and Classes. Each one of this classes has it's own properties, but the main Workflow to add stuff into this application is firstly adding an Artist, then the Album related to this Artist, and finally the songs that belong to the artist's album. I'd recommend using Postman to send the requests to the API. Don't forget to use the root URL: https://musicrestfulapi.azurewebsites.net/ + the method url

Swagger online documentation:

Artists

POST: inside Postman, send a POST request with a form-data structure, containing the Name, Gender and an Image file (image file needs to be lighter than 100kb).

artistPost

GET methods: You can use all these GET Methods to fetch data from the Artists model class.

image

Albums

POST: inside Postman, send a POST request with a form-data structure, containing the Name, an Image file (image file needs to be lighter than 100kb) and the ArtistId (you need to know the Id of the artist you registered in the application, because it works as a foreign Key). The "Songs" property is a collection that stores all songs of this album, it works as a Foreign key and you don't need to use this property in your request.

albumsPost

GET methods: You can use all these GET Methods to fetch data from the Albums model class.

albumsGET

Songs

POST: inside Postman, send a POST request with a form-data structure, containing the Title, Duration, IsFeatured, an Image (file needs to be lighter than 100kb), the SongUrl (the url links are simply the youtube links to the song), ArtistId (You need to know the Id of the artist this song belongs to) and the AlbumId(you need to know the Id of the album this song is contained).

songsPost

GET: You can use all these GET Methods to fetch data from the Songs model class. songsGet

Roadmap

I'll probably leave this as it is: a free and open-source application that users can send requests to the API and see it's functionality. In the future, I'll make other projects that implements JWT authentication and also includes both PUT and DELETE http methods.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Luiz Felipe - luizfelipers19@gmail.com

Project Link: https://github.com/luizfelipers19/musicAPI/

Drop a Star for future projects

About

A Restful API to fetch and input data about Songs. Built with .NET 5.0 and C#.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages