Skip to content

A Django REST API for storing my magic card collection

License

Notifications You must be signed in to change notification settings

ZanderSparrow/magic-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Magic Gathering API

A RESTful API for gathering a collection of Magic: The Gathering cards.

Endpoints

GET /cards/

Returns a list of all magic cards in the collection.

GET /cards/?name=

Returns the card with the specified name.

GET /cards/?colors=&colors=

Returns cards whose mana cost contains any of the specified colors.

POST /cards/

Creates a new magic card.

Request Body:

{
    "name": "Card Name",
    "current_value": 10.99,
    "description": "Card description",
    "image_url": "https://example.com/card-image.jpg",
    "mana_cost": "2UU"
}

PUT /cards/id/

Updates the card with the specified ID.

Request Body:

{
    "name": "New Card Name",
    "current_value": 11.99,
    "description": "New card description",
    "image_url": "https://example.com/new-card-image.jpg",
    "mana_cost": "3UU"
}

DELETE /cards/id/

Deletes the card with the specified ID.

Running the API

  1. Install the required dependencies using pip:
pip install -r requirements.txt
  1. Run the migrations to create the database tables:
python manage.py migrate
  1. Start the development server:
python manage.py runserver
  1. Use a tool like curl or Postman to test the API endpoints.

Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.

About

A Django REST API for storing my magic card collection

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published