Sunday 8 December 2019

Swagger - REST API documentation tool

Swagger - REST API documentation tool


Question: What is swagger?
It is REST API documentation tool which is used to list the APIs and view the request and response.
In this, we need to add some annotations in your functions and then it will automatically generate a beautiful and user-friendly documentation for your APIs.



Question: Where it is used?
Whenever we develop an android, IOS (Apple) application, we need to create an APIs for them.

To check the API details (URL, Request, response), we use Swagger.


Question: Who is using swagger?
Backend Developer: developer used it while creating Or updating an API.
Team Leader: As it give List of APIs with request and response. Team leader used it review the APIs.
Android/IOS Developer: While integrating the APIs, Its quite help the developer because they can check the response of APIs with different request.


Question: What are benefits of swagger?
  1. Its give list of APIs with short description.
  2. Its give the Request and Response of API.
  3. We can test the response of API with different request.
  4. We need to integrate in application first time, after the we need to add some annotations in functions/APIs.
  5. Can be integrate in Core PHP or Framework.
  6. We need not to list and details of apis manually.



Question: What is Swagger Editor?
The Swagger Editor is the tool for quickly getting started with the Swagger Specification.
Create new APIs OR update existing ones in a powerful Editor which visually renders your Swagger definition and provides real time error-feedback.
http://editor.swagger.io/#/


Question: Give a Demo URL?
http://petstore.swagger.io/


Question: From where i can download?
http://swagger.io/docs/#swagger-ui-documentation-29


Question: How to Add API in swagger?
Add Following code before the class declaration
/**
 * @SWG\Resource(
 *     apiVersion="1.0",
 *     swaggerVersion="1.2",
 *     description="Search users"
 * )
 */



Question: How to add new Operation for an API?
Add Following code before the method declaration
    /**
     * @SWG\Api(
     *     path="/search",
     *     @SWG\Operation(
     *         method="POST",
     *         summary="Get users near your location",
     *         type="Users list",
     *         @SWG\Parameters(
     *             @SWG\Parameter(
     *                 name="interests",
     *                 paramType="form",
     *                 description="comma seperated looking for",
     *                 required=false,
     *                 type="string",
     *                 minimum="1.0"
     *             ),
     *             @SWG\Parameter(
     *                 name="page",
     *                 paramType="form",
     *                 description="page number",
     *                 required=true,
     *                 type="string",
     *                 minimum="1.0"
     *             ),
     *         ),
     *         @SWG\ResponseMessage(code=400, message="Invalid Data")
     *     )
     * )
     */



Difference between channel and playlist on youtube

Difference between channel and playlist on youtube

A channel is your identity on YouTube, like your name, where your upload videos.
OR
A channel  is the home page for an your youtube account.

Question: What details are available on Channel page?
--- Basic information like Your Name, Account type etc.
--- Your public videos which you have uploaded.
--- Listing of playlist.


Question: What we can do on Channel page?
--- Update your information. --- upload videos.
--- customize the color theme of your channel.
--- Others can subscribe your channel.



Question: Sample of Youtbe Channel?
https://www.youtube.com/channel/UCFPS0qKgr-GbSRAppOkdpUA



Question: What is playlist?
A playlist is a collection of videos you may saved.


Question: List of Playlist (After Login on youtube.com with your gmail.com account)
https://www.youtube.com/view_all_playlists


Create a New Playlist (After Login on youtube)
https://www.youtube.com/view_all_playlists
Click on "New Playlist", an popup will prompt, just add the your playlist name


Question: How to add videos in playlist?
Go to playlist page (Like https://www.youtube.com/playlist?list=PLREKFLRZTg5xJJHmLiKZ0VBTKpubGXksb).
Click on "Add Videos" (Middle Right side).
An Popup will prompt.
Just add the YouTube video URL (Any video which you like) and follow Steps.


Question: What you can do with your playlist?
--- Make the playlist as public/private.
--- Add notes to each videos.
--- Re-ordering the videos.
--- AutoPlay on/off for videos.
--- Share your playlist on Fb.
--- Embed your playlist videos in your website/blog.



Question: Need Playlist Sample URL

https://www.youtube.com/playlist?list=PLREKFLRZTg5xJJHmLiKZ0VBTKpubGXksb



Question: Can we earn money with playlist?
No, You can't earn money on other's video (Uploaded by other).
You can earn money with your own videos (uploaded by you)