WSO2 API Manager is a complete solution for publishing APIs, creating and managing a developer community and for routing API traffic in a scalable manner. It leverages the integration, security and governance components from the WSO2 Enterprise Service Bus, WSO2 Identity Server, and WSO2 Governance Registry. In addition, as it is powered by the WSO2 Business Activity Monitor (BAM), the WSO2 API Manager is ready for massively scalable deployments immediately.
...
Log in to the Management Console (
https://<hostname>:9443/carbon)
of the API Manager using admin/admin credentials.- Select the Users and Roles menu under the Configure menu.
- Click the Roles link and then click Add New Role.
- Give the role name as
creator
and click Next.
- A list of permissions opens. Select the following and click Finish.
- Configure > Governance and all underlying permissions
- Login
- Manage > API > Create
- Manage > Resources > Govern and all underlying permissions
Similarly, create the
publisher
role with the following permissions.- Login
- Manage > API > Publish
Note that the API Manager comes with the
subscriber
role available by default. It has the following permissions:- Login
- Manage > API > Subscribe
- Note that the roles you added (creator, internal/subscriber, and publisher) are now displayed under Roles.
Let's create users for each of the roles. - Click the Users and Roles menu under the Configure menu again.
- Click the Users link and then click Add New User.
- Give the username/password and click Next. For example, let's create a new user by the name
apipublisher
.
Select the role you want to assign to the user (e.g.,
publisher
) and click Finish.
Similarly, create a new user by the name
apicreator
and assign the creator role.
...
After saving the API, click its thumbnail in the API Publisher to open it.
Click on the API's Docs tab and click the Add New Document link.
The document options appear. Note that you can create documentation inline, via a URL, or as a file. For inline documentation, you can edit the content directly from the API publisher interface. You get several documents types:
- How To
- Samples and SDK
- Public forum / Support forum (external link only)
- API message formats
- Other
Create a 'How To' named
PhoneVerification
, specifying in-line content as the source and optionally entering a summary. When you have finished, click Add Document.
Once the document is added, click Edit Content associated with it to open an embedded editor.
Enter your API's documentation.
...
The steps below explain how to configure WSO2 Business Activity Monitor (BAM) 2.5.0 with the API Manager. The statistics in these dashboards are based on data from the BAM. The steps below explain how to configure WSO2 BAM 2.5.0 with the API Manager.
Tip |
---|
If you are on Windows, note the following:
|
Let's do the configurations first.
Apply an offset of 3 to the default BAM port by editing the
<BAM_HOME>/repository/conf/carbon.xml
file. This makes the BAM server run on port 9446 instead of the default port 9443, and avoids port conflicts when multiple WSO2 products run on the same host.Code Block language xml <Offset>3</Offset>
- Install MySQL server and a suitable client like the MySQL Workbench. You can get the instructions manual from httpDownload MySQL from https://devwww.mysql.com/doc/ and install it in your server.
Go to the command-line and issue the following commands to connect to the MySQL server and create a database (e.g., TestStatsDB). This database is used to save the statistical data collected by the BAM. You do not need to create any tables in it.
Code Block mysql -u <username> -p <password> -h <host_name or IP>; CREATE DATABASE TestStatsDB;
Save the MySQL connector JAR inside both the
<APIM_HOME>/repository/components/lib
and<BAM_HOME>/repository/components/lib
folders.Give the datasource definition under the
<datasource>
element in the<BAM_HOME>/repository/conf/datasources/master-datasources.xml
file. For example,Code Block language xml <datasource> <name>WSO2AM_STATS_DB</name> <description>The datasource used for getting statistics to API Manager</description> <jndiConfig> <name>jdbc/WSO2AM_STATS_DB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://localhost:3306/TestStatsDB</url> <username>db_username</username> <password>db_password</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </definition> </datasource>
Start the BAM server by running either of the following commands in the command line:
- On Windows:
<PRODUCT_HOME>\bin\wso2server.bat --run
On Linux/Solaris/Mac OS:
sh <PRODUCT_HOME>/bin/wso2server.sh
- On Windows:
- Start the API Manager and log in to its Admin Dashboard Web application (
https://<Server Host>:9443/admin-dashboard
) with admin/admin credentials. Click the Configure Analytics menu.
Select the check box to enable statistical data publishing and add the following:
- Add a URL group as tcp://<BAM server IP>:7614 and click Add URL Group.
- Fill the details under Statistics Summary Database according to the information you added to the
master-datasources.xml
file in step 4.
Click Save. The BAM deploys the Analytics toolbox, which describes the information collected, how to analyze the data, and the location of the database where the analyzed data is stored.
Invoke several APIs to generate some statistical data and wait a few seconds.
- Connect to the API Publisher as a creator or publisher and click the statistical dashboards available under the All Statistics and Statistics menus. For example,
The All Statistics menu is available for both API creators and publishers. It shows statistics of all APIs. The Statistics menu is available for API creators to see statistics of only the APIs created by them.
...