Layer7 API Management

 View Only
  • 1.  Policy allocation on API deployment

    Posted May 07, 2020 09:12 AM

    Hi colleagues!

    We prepare a demo for our customer on API monetisation with Layer 7 API Gateway. We created an included policy fragment (Store to MySQL) to store data from API response to DB. The idea is to demonstrate capability to form data  for billing. Then we set it as a Portal publishable fragment and created encapsulated assertion from it. Now it is available in Portal as a template policy and we can deploy API with it. When API is deployed this policy is placed in top part of service definition. That is before the API call assertion (Route via HTTP …). But our fragment is to work with request results. The question is - how to place our policy AFTER the API call. Is it possible to manage the place where policy is placed in service definition on API deployment?

    A notice - if Standard 
    policy Template -API key is also included before our Template - everything works cause the "Route via HHTP" assertion is executed inside Standard policy Template

    Bet regards

    Andrey



  • 2.  RE: Policy allocation on API deployment

    Posted May 07, 2020 01:00 PM
    Hi Andrey,

    The second part of the Routing is only applicable if you have selected the options override template policy. By Default the template (encapsulation) in your case is Standard Template API Key will be applied. and your response will be on a successful run.

    You will have to add an additional parameter in the input to pass input to MySQL from 

    e.g. if you want to use a variable in API key in you MySQL template you expose it as an Output variable in API Key Encapsulation and use the same variable as input in the MySQL template.

    Did you also take a look at PAPI metric API as it can be called for billing purpose
    Portal Metric Api


    ------------------------------
    Pre-Sales Consultant
    CA Southern Africa
    ------------------------------



  • 3.  RE: Policy allocation on API deployment

    Posted May 09, 2020 07:12 AM
    Hi Ronald,
    Thank you for your reply.
    You are absolutely right about  Standard Template API Key and our policy really works with it. But the problem is that no any Policy is a must so we can not be sure that  Standard Template API Key will be included or that our policy will be placed after it. Should the policy definition have an attribute like "preprocess/postprocess" to regulate where policy is placed in service definition - before Route or after it, it would be much easier to manage all that stuff. 
    As for the PAPI - we have an amusing experience. Our installation. We downloaded the latest versions of Gateway and Portal. We installed Gateway V10. Then we installed/deployed Portal V4.5. And the Portal goes with its own Gateway v9.X. The PAPI were deployed to that Gateway with portal but failed for our Gateway v10. Now we have the situation when Portal occasionally connects to our Gateway or to it's embedded one. We sometimes get list of Polices with PAPI and sometimes, when Portal connects to external Gateway, without PAPI policies. We tried to add Portal embedded gateway to our cluster to synchronise then but Gateways V10 and V9 are incompateble and can not be added to one cluster. I think we just drop down the embedded one.  The question is how to port all the Policies to our external Gateway.

    Thank you

    Best regards


  • 4.  RE: Policy allocation on API deployment
    Best Answer

    Posted May 12, 2020 07:10 AM
    Edited by Christopher Hackett May 15, 2020 01:46 PM
    The easiest way I achieve it is Creating an Enscapustaion and importing the encapsulation in all relevant standard policies that have routing



    Pre-processing Task is achieved in Portal Service Preface <Policy in API Portal Integration folder>

    Unfortunately, there is no Post Processing policy as the Gateway Bundle push is like a template that originates from Portal so I am not sure if we can edit it

    ------------------------------
    Pre-Sales Consultant
    CA Southern Africa
    ------------------------------

    Attachment(s)



  • 5.  RE: Policy allocation on API deployment

    Posted May 12, 2020 07:42 AM
      |   view attached

    Also since you are doing Pre-Sales . Here is cool python script my colleague from Pre-Sales  Roan Linde build for Billing information using metric API

    Just update the env details to reflect your PAPI URL and update the extension from .txt to .py (attached)


    It Consolidates all the Organization --> APP -->Count that can be used for billing



    ------------------------------
    Pre-Sales Consultant
    CA Southern Africa
    ------------------------------

    Attachment(s)

    txt
    mapi.py.txt   16 KB 1 version