This video requires knowledge of #pydantic If you are not familiar with the #pydantic then I suggest you to view the video on • FastAPI - data validation with pydantic.
In this video, we will implement a POST rest api endpoint and we use the #pydantic to validate the data and return the expected status codes for the #fastapi create endpoint.
We will be implementing the below requirements for the #restapi create endpoint.
create course api endpoint - /courses
request method: POST
request body: {
"name": "c",
"type": "compiled",
"description": "c programming",
"price": 800
}
data constraints:
name: max length 50
type: one of "compiled", "interpreted"
description: max length 500
price: max price 1000
response status codes:
201 - create
409 - already exists
422 - unprocessable entity
You can check the source code in my github repository https://github.com/AnjaneyuluBatta505...