1/18
Looks like no tags are added yet.
RESTful API (Representational State Transfer API)
an architectural style for designing networked applications
stateless - no client context is stored on the server
the client and server are independent
URLs represent resources, not actions
relies on HTTP methods
uses HTTP status codes
HTTP methods
GET
PUT
POST
DELETE
GET (HTTP method)
retrieve data
PUT (HTTP method)
update resource
POST (HTTP method)
create new resource
DELETE (HTTP method)
remove resources
HTTP status codes
200 OK
201 Created
400 Bad Request
404 Not Found
500 Internal Sever Error
200 OK (HTTP status code)
Success
201 Created (HTTP status code)
new resource created
400 Bad Request (HTTP status code)
client-side error
404 Not Found (HTTP status code)
resource does not exist
500 Internal Server Error (HTTP status code)
server-side error
Flask
lightweight, open-source Python web microframework used to build web applications and RESTful APIs quickly without forcing a rigid project structure or built-in database layer
How can you build a RESTful API in Python?
using native Flask with native functions and jsonify
pros of building RESTful API in Python
easy to use
flexible and customizable
good for small to medium-sized applications
great for rapid prototyping and development
cons of building RESTful API in Python
not suitable for large-scale applications
limited functionality compared to other frameworks
requires additional setup for larger applications
app = Flask(__name__)
creates Flask application
CORS(app)
used for JavaScript operations
Postman
used to test the API during development to ensure it functions correctly and behaves as expected in various situations