Modern Python Projects Transcripts
Chapter: Documentation
Lecture: REST API documentation

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Now a days, a lot of projects are built based on micro services, so there is a chance that at some point in your career you will be building
0:08 a rest API, rest API supports a set of standard http request. For example, you can send a get request to get a list of users.
0:17 You can send the post request to create a new user or delete request. to delete that user, when you are building a rest API.
0:25 You can use a tool like swagger or re doc that will automatically generate a documentation for your rest endpoints. So in your code,
0:34 you just write the get post, put, delete and so on methods and those tools will automatically create a page that list those end points.
0:45 Let's see an example. So if you go to the swagger UI website there is a live demo page, and this is how the restAPI documentation could look
0:54 for your project. So all those things here are end points where you can send the rest request, and here you can see what parameters are required,
1:04 what are optional? What are the response calls, and so on? There is even an option to try it out. So you can add it this,
1:12 Json, and then execute the query. And here we have the response. It's the same with Redoc. We have the same example of pet store,
1:25 and here we can see the same thing. So documentation about the parameters, example
1:33 Json that we can send to our rest endpoint and the responses that we can get back, If you don't know what rest api is all that might look
1:43 confusing. But when you actually build one, those tools will be super useful.
1:47 For example, if you are working with some front end developers who are using react or vue Js and they want to see how they could get data from the
1:56 backend, you can just point them to those you or else, and they will be able to see all the documentation for themselves.
2:02 Some frameworks, like fast API, include those tools by default. So when you build a fast API application, you can go to this /docs, URL.
2:13 And then you will see the rest API documentation generated for you and the same with reDoc, with other frameworks like Django rest framework,
2:23 you can install them as a plugin, for me It's super convenient to use a tool like that, because each time I change something in
2:30 my code, all this documentation will be automatically generated for me.


Talk Python's Mastodon Michael Kennedy's Mastodon