Friday, 15 June 2018

Plan in Oracle API Cloud Service (CS)

Plans are used to group and entitle access for client applications to a set of APIs, enforcing some quality of service or access control criteria.

A plan can entitlement to one or multiple APIs. Multiple plan can be created to access the same API.

Below basic use cases why plans are required:
Use Case
Description
Monetization
Levels of Cost. For Example: Gold, Silver, Bronze plan.  The Gold plan may have unlimited access of APIs on higher cost. Silver plan may serve 1000 request per day on medium cost. Silver plan may service 100 request / day on lower cost
Group
Different Set of APIs. One plan provide access to all Employees APIs however another plan provide access to all Payroll APIs
Access control
Level of Access. One plan provide access to all API to developers however another plan provide access to other set of APIs to tester


Below are the steps to create Plan
  • Login to API CS console and navigate to the Plan
  • Click on Create button
  • Enter below information from the Plan Dialog and click Create button
    • Plan Name: Enter plan name
    • Version(Optional): Enter version number of the plan
    • Description(Optional): Enter brief description of the plan
  • The plan has been created and would be visible under the plan list

Enable restriction in the plan

Once the plan is ready, we implement it by setting rate limits and selecting gateways
  • Click on MyPlan and Settings tab
  • There are two settings can be applied there:
    • Plan Rate Limits
    • Gateways
Plan Rate Limits

Rate limits are a way of giving applications more requests at higher cost levels. 

Rate limits apply across all entitlements. For example, if we have a plan with entitlements to three different APIs, and then set a rate limit of 1000 requests per minute which means that requests to all three APIs combined cannot exceed 1000 per minute.

We can set multiple rate limit conditions. In this case, the most restrictive condition is the limiting factor. For example, we set two rate limit conditions, one for 1000 requests per second and another for 10000 requests per minute. The plan allows the full 10000 requests per minute, but if more than 1000 requests occur in any given second, the excess requests are rejected for that second.

Default rate limit for a plan is Unlimited.  Click Limited to set a specific rate limit and enter number of requests. Click the list box and select the time interval. The options are Second, Minute, Hour,Day, Week, Month, Year.

Setting Plan Gateways

We can select one or multiple gateways through which the plan will allow the APIs to be invoked.

In the Gateways section, set one of the following:

  • Click the All option to allow the plan to invoke APIs through all gateways to which an API is deployed.
  • Click the Specific option to select specific gateways through which the plan can invoke APIs. Click in the field below the option to display a list and select a gateway. To select additional gateways, click in the field again to display the list and choose a gateway
Once done Click on Save button

Plan Entitlements

An entitlement is the relationship between an API and a plan, describing that a plan entitles a client application to invoke an API, and under what conditions.

There is a many-to-many relationship between plans and APIs. A plan can have entitlements to multiple APIs

To Entitlements the APIs under the plan
  • Click on the Entitlements tab
  • Click on Add Entitlement button, select API/s and Click Add button
  • Publish and Activate the plan by clicking on the Activate and Publish button one by one

Note:  Publishing an entitlement makes it available to application developers in the Developer Portal and a plan must be active for it to be available for use.


No comments:

Post a Comment