REST API Management

Use the API Management page to add new APIs or edit/delete existing APIs. As shown in Figure,1 the Deployed APIs page displays the names of the existing APIs. The Edit action will take direct the user to the Edit API page whereas the Delete action will confirm and remove the API from the configuration. The Add API action will direct the user to the Add API page.

Figure 1: Show Existing APIs


Adding an API

Click on the Add API link. The Add API page will be displayed as shown below.

Figure 2: Add API

An API requires a Name, Context and at least one Resource. The Context should always contain a proceeding '/' character. In the design view, this character has been added by default and therefore will not require the user to re-enter. (See the / character before the text box of the Context).Hostname can be utilized to filter (incoming message 'hostname' details are included in the message transport headers) the given REST API resource with the incoming requests from client.

Click on the Add Resource link to add a Resource to the API. A form for entering Resource information will be displayed below the API management section. See Figure 3.

Figure 3: Resource Information



Click on the Update button to update the Resource. The Resource information section will be removed and a child Resource element will be added to the API tree. See Figure 4.
Clicking on the Resource icon on the tree will load the Resource Information section back again with details of the particular Resource.

Figure 4: API Tree


Once all API and Resource information has been entered, clicking on the Save button will cause the API to be saved in the ESB configuration. A confirmation message will also be shown as below.

Figure 5: Add API Success


Editing an API

Editing a saved API can be done by clicking on the Edit link on the Deployed APIs page. This will redirect the user to a page on which the API information will be loaded. When in the Edit mode, changing the API name will not be allowed.
Adding new Resources, Editing/Deleting existing Resources are allowed.
Once the modification of the API information is complete, clicking on the Save button will result in the API details being saved in the ESB configuration. A confirmation message will also be shown as below.

Figure 6: Edit API Success


Source View

Clicking on the Switch to source view link will result in the xml source of the API to be displayed. The Source View and Design View are synchronized. Changes made to the Design View are reflected on the Source View and vice versa. See image below.

Figure 7: Source View


For more information please refer to the WSO2 library