Add API to Policy Manager 8.0
Table of Contents
- Step 1: Install and Configure Policy Manager
- Step 2: Add API to Policy Manager
- Step 3: Configure Policies
- Step 4: Create Contracts
- Step 5: Send Test Request
Learn how to add a simple API to the Policy Manager Management Console, configure associated Policies and Contracts, and send a test request.
Step 1: Install and Configure Policy Manager
Install and configure Policy Manager 8.0. Refer to the installation instructions.
Step 2: Add API to Policy Manager
There are three parts to this:
- Log into the Policy Manager Management Console.
- From the Organization Tree, click Registry.
- Click Add Organization from the Actions Portlet.
- Indicate where you'd like to place the organization on the Organization Tree. Click Next.
- Give your organization a name, Click Finish, then Close.
- From the Organization Tree, click on the organization you created.
- On the Services Summary, click Create Physical Service.
- Select the Create Without Using Service Descriptor Document option and click Next.
On the Service Details, specify the following, then click Next.
- Name - The name of the API.
- QName - Provide a unique Namespace and Localpart. This is used internally by the system to uniquely route to a service or API.
- On Schema Import Options, select Use Existing Schemas and click Next.
- Click Add Operation. Specify an optional name and description and click Next.
- The Operation Details screen gives you the opportunity to specify Schema elements/types for your operation. For simplicity's sake, under Schemas, click >> to assign anyType to "Input" and the "Output." You can leave "Fault" blank and click Next to continue.
On the Binding Properties screen, choose the following and click Next:
- Method - In our example, we used the GET operation.
- URI Syntax - This is the path for your operation. Regular expressions can be used. Use the left-side panel to get more information.
- Next choose how you would like to manage the Service (API). Select Manage through a Virtual Service option. This will create a proxy service that is hosted in the container. Click Next.
- In Virtual Service Provider Organization, ensure that the correct organization is selected and click Next.
- Select the container that you created when registering the Network Director and click Next.
- Select the first Access Point in the list. Provide a name and click Next.
- In HTTP Details, enter a Location such as "/posts".
- Click Finish, and then click Close.
When you've finished, you'll have two services: a physical and a virtual service.
Add Access Point to Physical Service
- From the Organization Tree, select Organization > Services of the physical API you're registering.
- Select the Access Points tab and click Add Access Point.
- Leave all defaults for the Service Details and Binding Details.
- Add a WSDL Port Name and click Next.
- Under the HTTP Details section, enter the API web address for our example: http://demo.akana-dev.net:3005/posts in the Location field and click Finish.
Step 3: Configure Policies
Next you will configure your API’s with the policies you want Akana to enforce.
- From the Organization Tree, select the organization you’d like to apply the policies to.
Click Policies. In the Operational section of the Policy Attachments Portlet click Manage. For our example, we will set up an operational policy. The choices are:
- Compliance checks that the service is compliant with your set of standards.
- Operations does security and monitoring for the service.
- QoS (Quality of Service) does things like ensure availability, speed, etc.
- From the Manage Operation Attachments window, click Policies > Operational Policies.
- Choose DetailedAuditing then click Apply.
You can find all descriptions of the policies in the Organization Tree.
Step 4: Create Contracts
A contract gives someone (typically another application,) authorization to access an API.
- From the Organization Tree, select your organization.
- Click Offer Contract from the Actions Portlet. The Add Contract Wizard launches.
- Enter the contract details.
- In the Access Controls, select the anonymous contract option (i.e., second option) and click Next.
- Select the Provider Organization and click Finish.
Your contract is now in draft mode. Next you must activate it:
- Navigate the Organization Tree to find your Organization. In the Contracts folder find your contract.
- Scroll down to the Consumers section. You'll see your contract in "Draft."
- Click on the contract. In this example, it shows as "Anonymous."
- Review the contract, then in the Contracts Actions Portlet click Activate Contract, then OK.
Step 5: Send Test Request
To send a test request, you will need the endpoint.
- You can find this in the Policy Manager Organization Tree, under Your Organization > Services > API.
- Select the Access Points tab.
- Find the URL, then copy the URL and paste into a browser window. You should get a successful response.
- Verify that the requests are coming through by checking the audit logs. You can see the logs by selecting the organization, then the API. From the API page, click Monitoring > Logs. You'll see request details.
Auditing Use Cases
The following detailed use cases illustrate how to perform basic or detailed auditing of an entire message and view the message metrics in Policy Manager.