Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Madagascar Zoo API (FastAPI)

A simple API with animals from the Madagascar zoo (Alex, Melman, Marty, Gloria) – GET and POST endpoints + Postman tests.

Getting started

  1. Install dependencies:
pip install fastapi uvicorn
  1. Start the server (from the folder containing main.py):
uvicorn main:app --reload
  1. The API runs at http://127.0.0.1:8000

Interactive documentation (Swagger): http://127.0.0.1:8000/docs – you can try the endpoints directly in your browser there.

Endpoints

Method URL Description
GET /animals returns all animals
GET /animals/{id} returns one animal by its id
POST /animals adds a new animal (JSON body)

Example POST body:

{
  "name": "King Julien",
  "species": "lemur",
  "age": 7
}

Postman

  1. Open Postman → Import → select the zoo_api.postman_collection.json file
  2. The Madagascar Zoo API collection will be imported; each request has tests in the Tests tab (Scripts → Post-response in newer Postman versions)
  3. The server must be running before you run the tests (uvicorn main:app --reload)
  4. Run the requests individually, or run the whole collection at once: right-click the collection → Run collection

Note: the "GET animal by id" request uses the {{animalId}} variable set by the POST request – run POST first (the Collection Runner executes requests in order automatically).

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages