A Ruby on Rails Friday Project excercise for building an API. Epicodus, 2020.
- Clone in terminal : https://github.com/JoseyKinnaman/animal_shelter_api.git
- Navigate into directory by typing "cd animal_shelter_api"
- Type "bundle install" to bundle gems
- Type "rake db:setup" to create databases and migrations
- Type "rails s" to run on local server
- Access "localhost:3000"
- Heroku in Postman or cURL for calls. https://animal-shelter-api.herokuapp.com/pets/random
- /pets returns all pets and their parameters (id, breed, age, desc, gender, adoptable, species)
- /pets/:id returns an pet and its parameters matching the id
- /pets/random will return a random pet and its parameters
- /pets?name= will return a search result for a pet by a specific name
- /pets?page=2 will return a list of 10 pets per page
- /pets/:id will delete an pet and its parameters matching the id
- /pets will create an pet and add it to the database
- /pets/:id will update a parameter or parameters of an pet
- no known bugs
- Ruby
- Rails
- Active record
- Postgres
Jozy Kinnaman (c) 2020 MIC
This API uses POST
request to communicate and HTTP response codes to indenticate status and errors. All responses come in standard JSON. All requests must include a content-type
of application/json
and the body must be valid JSON.
200: Success
400: Bad request
401: Unauthorized
404: Cannot be found
405: Method not allowed
422: Unprocessable Entity
50X: Server Error
100: Bad Request
110: Unauthorized
120: User Authenticaion Invalid
130: Parameter Error
140: Item Missing
150: Conflict
160: Server Error
http code 402
{
"code": 404,
"message": "Cannot be found
",
"resolve": "Couldn't find Pet with 'id'=101"
}