Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jpblicer/metal-api
Ruby Backend API for storing Metal Bands
https://github.com/jpblicer/metal-api
api cors heavy-metal ruby
Last synced: about 1 month ago
JSON representation
Ruby Backend API for storing Metal Bands
- Host: GitHub
- URL: https://github.com/jpblicer/metal-api
- Owner: jpblicer
- Created: 2024-09-05T13:17:50.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2024-09-08T11:22:02.000Z (4 months ago)
- Last Synced: 2024-10-13T02:21:02.257Z (2 months ago)
- Topics: api, cors, heavy-metal, ruby
- Language: Ruby
- Homepage:
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Heavy Metal API
This is a basic API that allows POST and GET calls. [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) is enabled so it is frontend compatible at any origin.
## Making a Get Request
```
curl localhost:3000/api/v1/bands | jq .
```
Note that the pipe into jq just makes the response human readable
### You query the response by the name of the band by parassing parameters `?name=` like so:
```
curl "localhost:3000/api/v1/bands?name=mega" | jq .
```## Making a Post Request
Band Name is the only required field and must be unique
You can provide an object of member names and instruments and an array of albums.### Example
```
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"name": "Judas Priest",
"members": {
"Rob Halford": "vocals",
"Glenn Tipton": "lead guitar",
"Richie Faulkner": "lead guitar",
"Ian Hill": "bass",
"Scott Travis": "drums"
},
"albums": [
"British Steel",
"Screaming for Vengeance",
"Defenders of the Faith",
"Painkiller",
"Turbo"
],
"country": "UK"
}' \
localhost:3000/api/v1/bands
```