-
Notifications
You must be signed in to change notification settings - Fork 2
How to use Swagger
Swagger allows you to describe the structure of our APIs so that machines can read them. By reading API’s structure, we can automatically build beautiful and interactive API documentation. We can also automatically generate client libraries for our API and explore other possibilities like automated testing. Swagger does this by asking our APIs to return a JSON that contains a detailed description of our entire API.
- What are all the operations that the API supports?
- What are API’s parameters and what does it return?
- Does our API need some authorization?
- And even fun things like terms, contact information and license to use the API.
-
Start the project. By default, you will see Swagger UI.
-
Authorization:
Go to
Token
endpoint: ClickTry it out
:- Credentials look like:
{ "password": "{your password}", "email": "{your email}" }
then click
Execute
. You will receive a response like this:Copy
"tokenString"
value. (example : eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdW.....) .Go to
Authorize
button on the top of the page:Click on it and in the
Value:
textbox writeBearer {your token string}
Example:
Well done! Now you are ready to request API endpoints!
You can read more about it here. Have fun.