Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:how_to_use_swagger_ui_and_postman_for_biostar_2_api [2018/02/27 09:29]
jypark [Swagger UI]
— (current)
Line 1: Line 1:
-===== How to use Swagger UI and Postman for BioStar 2 API ===== 
----- 
- 
-==== Swagger UI ==== 
-It is a tool which helps test and document ** *REST API ** easily. ​ \\  
- 
-**[Request methods for REST API]** ​ \\ 
-{{:​en:​api_9.png?​nolink&​700|}} ​ \\ \\ 
- 
-We recommend that you should use Local API(after installing BioStar 2 API Server on local PC where BioStar 2 Server is installed). 
-When you send the message to BioStar Server via API, you have to use URL format below: ​ \\ 
-http://​127.0.0.1:​8795/​v2/​ //[url path displayed API reference]// ​ \\ \\ 
- 
- 
-The URL is different depending on BioStar 2 version. ​ \\ 
-  * BioStar v2.3 or below (v1 API) - http://​127.0.0.1:​8790/​v1/​docs/ ​ \\ 
-  * BioStar v2.4 or above (v2 API) - http://​127.0.0.1:​8795/​v2/​docs/ ​ \\ 
- 
-{{:​en:​api_4.png?​nolink&​700|}} \\ 
- 
-We provide the information on BioStar 2 API through the Swagger UI so that you can check kinds of APIs and those model schemas before calling API. Below is an example for the way to utilize this tool by using login API. \\ \\ \\ 
- 
-==== How to utilize Swagger UI ====  
-  * <wrap em>POST /login API</​wrap>​ 
-1) Click yellow box about **Model Schema** in **Parameters** section. Then, these contents will be copied and pasted into the **Value** (white box) in the same section. \\ 
-2) Type the values in the white box in order to login to BioStar 2. \\ 
-3) Click **Try it out** button to check the result about response message. \\ 
-  ​ 
-{{:​en:​api_5.png?​nolink&​700|}} \\ \\ \\ 
- 
-==== How to utilize Postman with Swagger UI ====  
-Postman is a Chrome App which helps you confirm the result of calling API easily. We recommend you to use it. By using the postman, you can construct complex HTTP requests quickly, organize them in collections and share them with your co-workers. The biggest advantage is that the history you call API is remained. \\ \\ 
-You can download the Postman through the Chrome web store. \\ 
-https://​chrome.google.com/​webstore/​search/​Postman?​hl=en \\ \\ 
- 
-  * <wrap em>POST /login API</​wrap>​ 
-  In the Swagger UI .. \\ 
-1) Click yellow box about **Model Schema** in **Parameters** section. Then, these contents will be copied and pasted into the **Value** (white box) in the same section. \\ 
-2) Copy all data shown in the white box. \\ 
- 
-{{:​en:​api_6.png?​nolink&​700|}} \\ \\ 
- 
-In the Postman .. \\ 
-3) Select **POST** in the drop box and then enter URL to call login API. \\ 
-4) Select **Body – raw – JSON(application/​json)** like below green box. \\ 
-5) Paste the data copied from Swagger UI into the Postman. \\ 
-6) Click **Send** button. \\ 
-7) The response result will be displayed in the bottom of section. \\ 
- 
-{{:​en:​api_7-1.png?​nolink&​700|}} \\ 
-{{:​en:​api_7-2.png?​nolink&​700|}} \\ \\ 
- 
-  * <wrap em>GET /login API</​wrap>​ 
-In the Swagger UI .. \\ 
-1) Check **Parameter** in **Parameters** section. Both limit and offset are mandatory as URL parameters. 
- 
-{{:​en:​api_8.png?​nolink&​700|}} \\ \\ 
- 
-In the Postman .. \\ 
-2) Select **GET** in the drop box and then enter URL to call login API. In case of GET message, you should use the necessary parameters in the URL. \\ 
- 
-<callout type="​warning"​ icon="​true"> ​ 
-Please note that there should be no space in the URL 
-</​callout>​ 
- 
-3) Click **Send** button. \\ 
-4) The response result will be displayed in the bottom of section. \\ 
- 
-{{:​en:​api_10.png?​nolink&​700|}} \\  
- 
- 
- 
- 
-