Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Restructure

This document guides you with the assumption that you have set up WSO2 Open Banking Key Manager, and WSO2 Open Banking API Manager in separate servers. 

...

Tip
titleBefore you begin
  1. Create a user with Internal/creator and Internal/publisher roles using https://<OBKM_HOSTNAME>:9446/carbon. To create users and roles, see configuring users and roles, which elaborates the steps to create the user as the API publisher.
  2. Set endpoints in the velocity_template.xml file.
  3. Configure sequence files.

Configuring

...

In the WSO2 Open Banking Berlin v1.1, it is mandatory to configure APIs for:

  • Accounts API v1.1
  • Payments API v1.1

Given below is the general procedure to configure and publish an API. 

Tip

...

Multiexcerpt include
MultiExcerptNameConfiguringAPIs
PageWithExcerptTry Local Setup

Configuring the velocity_template.xml file

velocity_template  file checks the deployed specification. The velocity_template.xml file in the <WSO2_OBAM_HOME>/repository/resources/api_templates/velocity_template.xml file, is by default configured to support berlin specification with the following handler. 

...

the velocity_template.xml file

velocity_template  file checks the deployed specification. The velocity_template.xml file in the <WSO2_OBAM_HOME>/repository/resources/api_templates/velocity_template.xml file, is by default configured to support berlin specification with the following handler. 

Code Block
languagexml
<handler class="com.wso2.finance.open.banking.berlin.consent.enforcement.ConsentEnforcementHandler">
    <property name="accountValidationUrl" value="https://<OBKM_HOST>:9446/consent/berlin110/accounts-validation"/>
    <property name="keyStore" value="./repository/resources/security/wso2carbon.jks"/>
    <property name="accountValidationUrlpassword" value="https://<OBKM_HOST>:9446/consent/berlin110/accounts-validationwso2carbon"/>
    <property name="keyStorealias" value="./repository/resources/security/wso2carbon.jkswso2carbon"/>
    <property
name="password" value="wso2carbon"/>
    <property name="alias" value="wso2carbon"/>
</handler>

...

Info

You need to get the latest product updates to validate the incoming request to APIs, in the current version of WSO2 Open Banking. This feature is available as a product update from  June 25, 2019 (06-25-2019)  onwards. Follow the instructions given below to apply changes.

Tip
titleBefore you update as follows;

Make sure you have added required changes to the API-Manager management console as mentioned here.

WSO2 Open Banking allows users to validate incoming requests to APIs against any customizations done to a swagger file. Update the RequestSchemaValidationHandler in the velocity_template.xml file as follows:

Code Block
#if($apiObj.additionalProperties.get("ob-spec") == "berlin") ………..
#if($!apiVersion == "v3.0" || $!apiVersion == "v3.1" || $!apiVersion == "v3.1.1" || $!apiVersion == "v2.0") ##add request validation handler <handler class="com.wso2.finance.open.banking.gateway.api.schema.validation.RequestSchemaValidationHandler"/>
#end

Configuring sequence files

Sequence files for Accounts and Payments must be updated separately in the <WSO2_OBAM_HOME>/repository/resources/finance/apis / berlin-group.org / <Name of the API> . Update the value of the <OBKM_HOSTNAME> with the hostname of the WSO2 Open Banking Key Manager server. 

By default, WSO2 Open Banking API Manager includes a mock bank backend, which is configured by default in the In sequences. Ideally, the two occurrences of https://<OBAM_HOSTNAME>:9443/open-banking/services/accounts/accountservice should be replaced by the core banking system's API endpoints corresponding to the production, and sandbox environments respectively. For more information, see Integrating Core Banking System for Berlin.

...

languagexml
titleAccountsAPI


...

Configuring sequence files

Sequence files for Accounts and Payments must be updated separately in the <WSO2_OBAM_HOME>/repository/resources/finance/apis / berlin-group.org / <Name of the API> . Update the value of the <OBKM_HOSTNAME> with the hostname of the WSO2 Open Banking Key Manager server. 

By default, WSO2 Open Banking API Manager includes a mock bank backend, which is configured by default in the In sequences. Ideally, the two occurrences of https://<OBAM_HOSTNAME>:9443/open-banking/services/accounts/accountservice should be replaced by the core banking system's API endpoints corresponding to the production, and sandbox environments respectively. For more information, see Integrating Core Banking System for Berlin

Localtabgroup
Localtab
titleAccounts API
Code Block
languagexml
<sequence xmlns="http://ws.apache.org/ns/synapse" name="accounts-dynamic-endpoint-insequence-2.0.0">
    <property name="endpointURI" expression="get-property('To')"/>
    <header name="TPP-Unique-ID" expression="get-property('api.ut.consumerKey')" scope="transport"/>
    <filter regex=".*\/consents.*" source="$ctx:endpointURI">
        <then>
            <property name="resourcepath" scope="default" type="STRING" value=""/>
            <property expression="get-property('resourcepath')" name="REST_URL_POSTFIX" scope="axis2" type="STRING"/>
            <header name="To" expression="fn:concat('https://<OBKM_HOST>:9446/consent/berlin110' , get-property('api.ut.resource'))"/>

            <rewrite>
                <rewriterule>
                   
<property
 
name="resourcepath" scope
<action type="
default
replace" 
type
regex="
STRING
\/consents" value="
"/
\/accounts" fragment="path"/>
            
<property
 
expression="get-property('resourcepath')"
 
name="REST_URL_POSTFIX"
 
scope="axis2" type="STRING"/>
 </rewriterule>
            </rewrite>

    
<header
 
name="To" expression="fn:concat('https://<OBKM_HOST>:9446/consent/berlin110' , get-property('api.ut.resource'))"/>
   </then>
        <else>
      
<rewrite>
      <filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION">
        
<rewriterule>
        <then>
            
<action
 
type="replace" regex="\/consents
       <header name="To" value="
\
https://<OBAM_HOST>:9443/open-banking-berlin/services/accounts"
fragment="path"
/>
                </
rewriterule>
then>
            
</rewrite>
    <else>
     
</then>
         
<else>
      <header 
<filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION">
name="To" value="https://<OBAM_HOST>:9443/open-banking-berlin/services/accounts"/>
                </else>
          
<then>
  </filter>
        </else>
    </filter>
    
<header
<property 
name
expression="get-property('To')" 
value
name="
https://<OBAM_HOST>:9443/open-banking-berlin/services/accounts"/> </then>
ENDPOINT_ADDRESS"/>
</sequence>
Localtab
titlePayments API
Code Block
languagexml
<sequence xmlns="http://ws.apache.org/ns/synapse" name="payments-dynamic-endpoint-insequence-2.0.0">
    <property name="endpointURI" expression="get-property('To')"/>
    <filter 
source="$ctx:endpointURI" regex=".*payments.*">
  
<else>
      
<then>
            <header name="
To
TPP-Unique-ID" 
value="https://<OBAM_HOST>:9443/open-banking-berlin/services/accounts
scope="transport" expression="get-property('api.ut.consumerKey')"/>
            <filter 
</else>
source="get-property('api.ut.HTTP_METHOD')" regex="POST">
                <then>
 
</filter>
         
</else>
     
</filter>
     
<property
<header 
expression
name="
get-property('
To
')
" 
name
value="
ENDPOINT_ADDRESS
https://<OBKM_HOST>:9446/consent/berlin110/payments"/>
</sequence>
Code Block
languagexml
titlePaymentsAPI
<sequence xmlns="http://ws.apache.org/ns/synapse" name="payments-dynamic-endpoint-insequence-2.0.0">

             
<property
 
name="endpointURI"
 
expression="get-property('To')"/>
     <filter source="$ctx:endpointURI" regex="
.*payments.*">
^((?!\/bulk-payments).)*$">
                        <then>
            
<header
 
name="TPP-Unique-ID"
 
scope="transport"
 
expression="get-property('api.ut.consumerKey')"/>
             
<filter source="get-property('api.ut.HTTP_METHOD')" regex="POST
<payloadFactory media-type="json">
                
<then>
                <format>[$1]</format>
    
<header
 
name="To"
 
value="https://<OBKM_HOST>:9446/consent/berlin110/payments"/>
                     
<filter
 
source="$ctx:endpointURI"
 
regex="^((?!\/bulk-payments).)*$">
   <args>
                     
<then>
               <arg evaluator="json" expression="$"/>
           
<payloadFactory
 
media-type="json">
                    </args>
            
<format>[$1]</format>
                </payloadFactory>
                
<args>
        </then>
                    </filter>
       
<arg
 
evaluator="json"
 
expression="$"/>
       </then>
                <else>
        
</args>
            <filter 
source="get-property('api.ut.HTTP_METHOD')" regex="GET">
             
</payloadFactory>
           <then>
             
</then>
               <property name="resourcePath" scope="default" type="STRING" 
</filter>
value=""/>
                            
</then>
<property expression="get-property('resourcePath')" name="REST_URL_POSTFIX" scope="axis2"
                
<else>
                     
<filter
 
source
type=
"get-property('api.ut.HTTP_METHOD')" regex="GET"
"STRING"/>

                       
<then>
     <header name="To"
                      
<property
 
name="resourcePath"
 
scope="default"
 
type="STRING"
 
value=""/>
          
<property expression="
expression="fn:concat('https://<OBKM_HOST>:9446/consent/berlin110', get-property('
resourcePath
api.ut.resource'))"
name="REST_URL_POSTFIX" scope="axis2"
/>

                            <rewrite>
            
type="STRING"/>
                  <rewriterule>
           
<header name="To"
                     <action type="replace" regex="\/payments\/sepa-credit-transfers" value="\/payments" fragment="path"/>
                                <action 
expression
type=
"fn:concat('https://<OBKM_HOST>:9446/consent/berlin110', get-property('api.ut.resource'))
"replace" regex="\/payments\/instant-sepa-credit-transfers" value="\/payments" fragment="path"/>
                             
<rewrite>
   <action 
type="replace" regex="\/payments\/target-2-payments" value="\/payments" fragment="path"/>
           
<rewriterule>
                     
<action type="replace" regex="\/payments\/
sepa
cross-border-credit-transfers" value="\/payments" fragment="path"/>
                                <action type="replace" regex="\/bulk-payments\/
instant-
sepa-credit-transfers" value="\/payments" fragment="path"/>
                                <action type="replace" regex="\/bulk-payments\/
target
instant-sepa-
2
credit-
payments
transfers" value="\/payments" fragment="path"/>
                                <action type="replace" regex="\/bulk-payments\/
cross
target-
border
2-
credit-transfers
payments" value="\/payments" fragment="path"/>
                                <action type="replace" regex="\/bulk-payments\/
sepa
cross-border-credit-transfers" value="\/payments" fragment="path"/>
                                <action type="replace" regex="\/
bulk
periodic-payments\/
instant-
sepa-credit-transfers" value="\/payments" fragment="path"/>
                                <action type="replace" regex="\/
bulk
periodic-payments\/
target
instant-sepa-
2
credit-
payments
transfers" value="\/payments" fragment="path"/>
                                <action type="replace" regex="\/
bulk
periodic-payments\/
cross
target-
border
2-
credit-transfers
payments" value="\/payments" fragment="path"/>
                                <action type="replace" regex="\/periodic-payments\/
sepa
cross-border-credit-transfers" value="\/payments" fragment="path"/>
                              </rewriterule>
         
<action
 
type="replace"
 
regex="\/periodic-payments\/instant-sepa-credit-transfers"
 
value="\/payments"
 
fragment="path"/>
               </rewrite>

                
<action
 
type="replace"
 
regex="\/periodic-payments\/target-2-payments" value="\/payments"
 
fragment="path"/>
     </then>
                    </filter>

     
<action
 
type="replace"
 
regex="\/periodic-payments\/cross-border-credit-transfers"
 
value="\/payments"
 
fragment="path"/>
       </else>
            
</filter>

        </
rewriterule>
then>
        <else>
            <filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION">
    
</rewrite>
            <then>
             
</then>
       <header name="To" value="https://<OBAM_HOST>:9443/open-banking/services/payments/paymentservice"/>
           
</filter>
     
</then>
          
</else>
      <else>
      
</filter>
          
</then>
    <header name="To" value="https://<OBAM_HOST>:9443/open-banking/services/payments/paymentservice"/>
  
<else>
             
<filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION">
 </else>
            </filter>
   
<then>
     </else>
    </filter>
    
<header name="To" value="https://<OBAM_HOST>:9443/open-banking/services/payments/paymentservice"/> </then> <else> <header name="To" value="https://<OBAM_HOST>:9443/open-banking/services/payments/paymentservice"/> </else> </filter> </else> </filter> <property name="ENDPOINT_ADDRESS" expression="get-property('To')"/> </sequence>
Excerpt
hiddentrue

Create a new version for an existing API

  • In the API Publisher (https://<OBAM_HOSTNAME>:9443/publisher), click the API thumbnail to view the API overview.
    API OverviewImage Removed
  • Click CREATE NEW VERSION.

    Tip

    Versioning allows several APIs to share the same scope.

  • Define the new version and click Done.

    Note

    The API version will be used in the velocity-template.xml file to configure the corresponding URLs, therefore it is advised to define the version as v1.0, v2.0, v3.0 or v3.1

    Image Removed
  • Click on the newly created API and click EDIT API.
  • Under API DEFINITION, click Import.
  • Select the swagger definition of the new API version from the <WSO2_OBAM
    <property name="ENDPOINT_ADDRESS" expression="get-property('To')"/>
    </sequence>


    Configuring an API

    In the WSO2 Open Banking Berlin v1.1, it is mandatory to configure APIs for:

    • Accounts API v1.1
    • Payments API v1.1

    Given below is the general procedure to configure and publish an API. 

    Tip

    Anchor
    WumUpdateForRequestValidationBG
    WumUpdateForRequestValidationBG

    Multiexcerpt
    MultiExcerptNameConfiguringAPIs
    1. Sign in to the API Publisher ( https:// localhost:9443/publisher ) with the a user whose roles include Internal/publisher. Follow the steps given below:

    2. Click ADD NEW API > I have an existing API

    3. Select the Swagger definition from <WSO2_OB_APIM_HOME>/repository/resources/finance/apis and configure the properties according to the open-banking specification. Find more information from the table given .


      Click Start Creating.
    4. Click Next: Implement to navigate to the next level.
    5. Expand Managed API, and use the table to select the relevant Endpoint Type from the drop-down list.
    6. Check Select a message mediation policy to be executed in the message flow under Message Mediation Policies.
    7. Click Upload In Flow and select the corresponding In sequence file from the <WSO2_OB_APIM_HOME>/repository/resources/finance/apis/berlin-group.org/ directory.

    8. Click Next: Manage to navigate to the next level.

    9. Expand Throttling Settings. Under Subscription Tiers, check the option as Unlimited : Allows unlimited requests unless you want to limit the requests.
    10. Expand API Properties and add the following values as Additional properties:

      Property Name

      ob-spec

      Property Value

      berlin
    11. Click the + button to save the above values.

    12. Click Save & Publish.

    Summarized information for configuring APIs

    Specification

    APIImplement tabManage tab
    Endpoint typeEndpointEnable Message mediation

    In flow


    API property nameAPI property value
    Berlin specificationAccountInfo API v1.1.0DynamicN/AMark as checked Select the respective In Sequence in the <WSO2_OB_APIM_HOME> /repository/resources/finance/apis
     directory.
    Import API DefinitionImage Removed
  • Click Import, and then click Next: Implement > to navigate to the next page.
  • Expand Managed API, and click Upload In Flow.
  • Select the In sequence of the corresponding API version, and click Upload.
    Upload mediation policyImage Removed
  • Click Next: Manage > to navigate to the next page.
  • Expand API Properties and ensure the ob-spec property is set to reflect the correct specification.
  • Click Save & Publish.
    /berlin-group.org/Accounts directoryob-spec berlin
    Payments API v1.1.0DynamicN/AMark as checkedSelect the respective In Sequence in the wso2-obam-version/repository/resources/finance/apis/berlin-group.org/Payments directoryob-specberlin

    Multiexcerpt include
    MultiExcerptNameCreateNewAPIVersion
    PageWithExcerptDeploying APIs for UK