Giter Site home page Giter Site logo

deploy-model's Introduction

Basic REST API using FastAPI

1. Index

Endpoint: GET /
Returns all items data as a dictionary.

2. Query item by id

Endpoint: GET /items/{item_id}
Parameters:

  • item_id: integer representing the id of the item to be queried.
Returns the item corresponding to the provided item_id parameter.
If no item corresponds to the provided item_id, raises a 404 Not Found error.

3. Query item by parameters

Endpoint: GET /items/
Query parameters:

  • name: (optional) string representing the name of the item to be queried.
  • price: (optional) float representing the price of the item to be queried.
  • count: (optional) integer representing the count of the item to be queried.
  • category: (optional) string representing the category of the item to be queried.
Returns the items that match the provided query parameters.
If no item matches the query parameters, returns an empty selection.
If no query parameters are provided, returns all items.

4. Add new item

Endpoint: POST /
Parameters:

  • item: JSON data representing an item to be added.
Adds the provided item to the items data.
If the item ID already exists in the data, raises a 400 Bad Request error.

5. Update item

Endpoint: PUT /update/{item_id}
Path parameter:

  • item_id: integer representing the id of the item to be updated.
Query parameters (all optional):

  • name: string representing the new name of the item.
  • price: float representing the new price of the item.
  • count: integer representing the new count of the item.
Updates the attributes of the item with the provided item_id.
If the item with the provided item_id does not exist in the data, raises a 404 Not Found error.
If no update parameters are provided, raises a 400 Bad Request error.

6. Delete item

Endpoint: DELETE /delete/{item_id} Parameters:

  • item_id: integer representing the id of the item to be deleted.
Deletes the item with the provided item_id from the data.
If the item with the provided item_id does not exist in the data, raises a 404 Not Found error.

deploy-model's People

Contributors

chuck1z avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.