官术网_书友最值得收藏!

  • WSO2 Developer’s Guide
  • Fidel Prieto Estrada Ramón Garrido Lázaro
  • 243字
  • 2021-07-08 10:05:56

Creating a REST API

Here, we will learn to create a Representational State Transfer (REST) API, that is, how RESTful services are created in WSO2EI. We create them from the Developer Studio dashboard by following these steps:

  1. Click on REST API:
  1. Choose Create A New API Artifact and click on Next.
  2. Add the following information:
    • Name: Name of the API; here, we will set it to my1stapi
    • Context: This is the root context our services will have, for example, my1stapi. Thus, when calling the API, the URL will look like http://localhost:8280/my1stapi. It must start with /.
    • Host name: We can leave it blank. It is used to filter the host that can invoke this API; if it is blank, everyone can call it.
    • Port: This is used if we need to bind the API to a specific port; here, we leave it blank.
    • Save location: Choose an ESB project to save it. Here, we choose My1stESBProject.
  1. Click on Finish, and the API structure will be added to the project. It will be placed in the My1stESBProject project in the project explorer in the path:
  1. If we double-click on the my1stapi.xml file, the API editor will open and will look like this:
  1. Now we are ready to implement our API functionality. API works the same way as proxy services. They both use in sequence, out sequence, and fault sequence, where logic is implemented.

We will go over RESTful services again later in the book.

主站蜘蛛池模板: 衡东县| 塔河县| 乌鲁木齐市| 盐津县| 遂川县| 合阳县| 凤台县| 托里县| 阳山县| 英吉沙县| 福贡县| 泊头市| 洛阳市| 沽源县| 涟水县| 德阳市| 墨竹工卡县| 安溪县| 唐河县| 重庆市| 绵竹市| 拉孜县| 桃园市| 都安| 邓州市| 神农架林区| 阿拉尔市| 体育| 射阳县| 南昌县| 梁山县| 富锦市| 沁水县| 台江县| 惠来县| 普兰店市| 万荣县| 子长县| 星子县| 南华县| 宝清县|