Yapay zekadan makale özeti
- Kısa
- Ayrıntılı
- Bu video, Ronald Kuyas tarafından sunulan ve Programlama Bilgisi ile işbirliği içinde hazırlanan bir eğitim serisinin ikinci bölümüdür. Önceki videolarda API kavramı, REST API'leri ve Postman kullanımı hakkında bilgi verilmiştir.
- Videoda, Flask RESTful kütüphanesi kullanılarak basit bir "Hello World" REST API'si oluşturma süreci adım adım gösterilmektedir. Eğitmen, bir to-do list API'si serisinin parçası olarak, iki farklı GET endpoint'i (localhost:5000/hello_world ve localhost:5000/hello_world/{name}) oluşturmayı, Postman ile test etmeyi ve JSON formatında veri döndürmeyi anlatmaktadır. Video, bir serinin parçası olup, bir sonraki videoda to-do list API'sinin get ve post işlemlerinin nasıl yapılacağı ele alınacaktır.
- 00:00Introduction to Flask RESTful API Building
- This video is a collaboration with Programming Knowledge and continues the series on building REST APIs with Python.
- Previous videos covered what an API is, what kind of API will be built, and how Postman can be used to test APIs.
- This video will jump straight into coding and build a simple "Hello World" REST API using Flask RESTful.
- 00:58Setting Up the Project
- Create a folder named "as_to_do_api" and a new file named "api.py".
- Import Flask and Flask RESTful libraries.
- Initialize the app and API using Flask and Flask RESTful classes.
- 03:01Setting Up Endpoints
- The app will have two endpoints: "/hello_world" and "/hello_world/{name}".
- "/hello_world" will return "Hello World" when accessed.
- "/hello_world/{name}" will return "Hello [name]" when accessed with a string name.
- 05:54Implementing Endpoints
- Create a class for "/hello_world" and inherit from Resource.
- Implement the get function to return "Hello World" as JSON.
- Create a class for "/hello_world/{name}" and implement the get function to return "Hello [name]" as JSON.
- 07:38Testing the API
- Run the server using Python 3 API Py.
- Use Postman to send a GET request to "/hello_world" and receive "Hello World" with status code 200
- Use Postman to send a GET request to "/hello_world/ronak" and receive "Hello Ronak" with status code 200
- Use Postman to send a GET request to "/hello_world/programming" and receive "Hello programming" with status code 200
- 11:22Conclusion
- The next video will focus on building a to-do API using Flask RESTful.
- The to-do API will include GET and POST methods for getting and creating to-dos.
- This video covered a very simple "Hello World" program in Flask RESTful.