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.
...
- Open the API Publisher (
https://<hostname>:9443/publisher)
and log in asapicreator
. Click the Add link and provide the information given in the table below. Click Implement once you are done.
Field Sample value Name PhoneVerificationContext/phoneverifyVersion 1.0.0 Visibility Public Resources URL pattern CheckPhoneNumber Request types GET, POST, OPTIONS Give the following information in the Implement tab that opens and click Manage once you are done.
Field Sample value Implementation method Backend Endpoint type HTTP Production endpoint In this guide, we work with a service exposed by the Cdyne services provider. We use their phone validation service, which has SOAP and REST interfaces. Endpoint is http://ws.cdyne.com/phoneverify/phoneverify.asmx.
This sample service has two operations as
CheckPhoneNumber
andCheckPhoneNumbers
. Let's useCheckPhoneNumber
here.Endpoint security scheme Non Secured (If secured, user is asked for credentials of the backend service) Click Manage to go to the
Manage
tab and provide the following information.Field Value Description Tier Availability Bronze/Gold/Silver/Unlimited The API can be available at different level of service; you can select multiple entries from the list. At subscription time, the consumer chooses which tier they are interested in. Tip Tip: For resources that have methods requiring authentication (i.e., Auth Type is not NONE), you set None as the Auth type of
OPTIONS
to support CORS (Cross Origin Resource Sharing) between the API Store and Gateway.Once you are done, click Save . Before we publish the API, let's document its parameters.and Publish.
Go to the API Store (
https://<hostname>:9443/store
) and note that the API you just published is listed there.
Adding API documentation
After saving the API, click on its thumbnail in the API Publisher to open it.
Click on the API's Docs tab and note 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
Click the Add New Document link.
- Select the
Create a 'How To
type, a name for the document and a short description, which will appear in the API Store. Select inline or provide a URL. - Click Add Document.
,' using in-line content as the source. The document name is
SimpleClient
and click the Add Document button.Once the document is added, click Edit Content link , which associated with it to opens an embedded editor to edit the document contents..
Enter your API's documentation.
Versioning the API
Next, we will Let's create a new version of this API.
- Log in to the API Publisher as
apicreator
if you are not logged in already. - Click on the
PhoneVerification
API and then the Copy button that appears in its Overview tab.
- Specify
Give a new version number
in version.major.minor format(e.g., 2.0.0) and click Done.
Tip Tip: The Default Version option means that you make this version the default in a group of different versions of the API. A default API can be invoked without specifying the version number in the URL. For example, if you mark http://host:port/youtube/2.0 as the default version when the API has 1.0 and 3.0 versions as well, requests made to http://host:port/youtube/ get automatically routed to version 2.0.
If you mark any version of an API as the default, you get two API URLs in its Overview page in the API Store. One URL is with the version and the other is without. You can invoke a default version using both URLs.
If you mark an unpublished API as the default, the previous default, published API will still be used as the default until the new default API is published (or prototyped).
A new version of the API is created. It is a duplication of all the contents of the original API, including the documentation. The API is now ready to be published. This is done by a user in the publisher role.
...