API Life Cycle Basics: API Management

The need to manage APIs is one of the older aspects of doing business with web APIs. Beginning around 2006, then maturing, and being baked into the cloud and markets by 2016. Whether it is through a management gateway that proxies existing APIs, natively as part of the gateway that is used to deploy the APIs themselves, or as a connective layer within the code, API management is all about authenticating, metering, logging, analyzing, reporting, and even billing against API consumption. This landscape has significantly shifted lately, with the bottom end of the market becoming more competitive, but luckily there are enough open source and cloud solutions available to get the job done.

Over the last decade, API management providers have collectively defined some common approaches to getting business done using web APIs. While still very technical, API management is all about the business of APIs, and managing the value generated from providing access to data, content, algorithms, and other digital resources using the web. Here are the handful of common aspects of API management, which are being baked into the cloud, and made available across a number of open source solution providers catering to the API space: https://goo.gl/vNXUQD #DataIntegration #ML

Integrate Jenkins Automation Server in an eCATT Test Process

At the moment moves the focus in our development more to native apps of mobile devices. In this context it is my goal to integrate the test envinronment of this app development in our eCATT scripts. The colleguaes of app develpment uses Jenkins, a fantastic automation server which supports developers in continuous integration (CI). The developers don’t do their builds with Jenkins only, the do also developer tests. And from this perspective we expect a synergy effect between the development tests outside SAP and test automation inside SAP.

In this scenario we use PowerShell as the bridge between Jenkins and the SAP backend. I described the way here, and an extension here.

Here my steps to integrate Jenkins inside eCATT script at SAP backend:

At first I installed Jenkins. An easy task, I used the web archive (war) and installed the plugins.

In the next step I installed an additional plugin to execute PowerShell scripts in Jenkins build processes.

Now I developed a tiny example remote enabled function module (RFM) at the SAP backend to receive a status and to store it in a table. FUNCTION YRFCTEST. *“———————————————————————- *”*“Lokale Schnittstelle: *” IMPORTING *“ VALUE(IV_RESULT) TYPE BOOLEAN *”———————————————————————- DATA: ls_rfcresult TYPE YRFCRESULT . LS_RFCRESULT-TIMESTAMP = SY-DATUM && SY-UZEIT. LS_RFCRESULT-BUILD_RESULT = IV_RESULT. INSERT YRFCRESULT FROM ls_rfcresult. ENDFUNCTION.

In the next step I developed a PowerShell script to set the status. This script uses dotNET connector (NCo) to connect the SAP system – you can find more information here. #-Begin—————————————————————– #-Sub Load-NCo——————————————————– Function Load-NCo { [String]$ScriptDir = “C:NCo” If ([Environment]::Is64BitProcess) { [String]$Path = $ScriptDir + “x64″ } Else { [String]$Path = $ScriptDir + ”x86″ } [String]$File = $Path + “sapnco.dll”; Add-Type -Path $File $File = $Path + “sapnco_utils.dll”; Add-Type -Path $File } #-Function Get-Destination——————————————– Function Get-Destination { #-Verbindungsparamter———————————————– $cfgParams = ` New-Object SAP.Middleware.Connector.RfcConfigParameters $cfgParams.Add($cfgParams::Name, “TEST”) $cfgParams.Add($cfgParams::AppServerHost, “localhost”) $cfgParams.Add($cfgParams::SystemNumber, “00”) $cfgParams.Add($cfgParams::Client, “000”) $cfgParams.Add($cfgParams::User, “BCUSER”) $cfgParams.Add($cfgParams::Password, “minisap”) Return [SAP.Middleware.Connector.RfcDestinationManager]::GetDestination($cfgParams) } #-Sub Invoke-SAPFunctionModule—————————————- Function Invoke-SAPFunctionModule { $destination = Get-Destination #-Metadaten——————————————————— $rfcFunction = ` $destination.Repository.CreateFunction(“YRFCTEST”) #-Importparameter setzen——————————————– $rfcFunction.SetValue(“IV_RESULT”, “X”) #-Funktionsbaustein aufrufen—————————————- $rfcFunction.Invoke($destination) } #-Sub Main———————————————————— Function Main () { Load-NCo Invoke-SAPFunctionModule } #-Main—————————————————————- Main #-Error routine——————————————————- Trap { [System.Reflection.Assembly]::LoadWithPartialName(“System.Windows.Forms”) > $Null [Void] [System.Windows.Forms.MessageBox]::Show( ` $_.Exception.GetType().FullName + ` [System.Environment]::NewLine + ` “Error at line ” + $_.InvocationInfo.ScriptLineNumber + ` “ in ” + $_.InvocationInfo.ScriptName + ` [System.Environment]::NewLine + [System.Environment]::NewLine + ` $_.Exception.Message, “An Error Occurred”, 0) Exit } #-End——————————————————————-

I integrated this script into my build process in Jenkins.

And after I start the build process in Jenkins, I got my entry in the table in the SAP system.

So far so well, on this way it is possible to send the result of a build process from Jenkins to an SAP system.

Last but not least a PowerShell script to execute the build process via Jenkins remote API. #-Begin—————————————————————– #-Sub Main————————————————————– Function Main() { $URI = “http://localhost:8090”; $User = “BCUSER”; $Password = “minisap”; $Headers = New-Object “System.Collections.Generic.Dictionary[[String],[String]]”; $Bytes = [System.Text.Encoding]::UTF8.GetBytes(“$($User):$Password”); $Base64 = [System.Convert]::ToBase64String($Bytes); $Headers.Add(“Authorization”,“Basic $Base64”); [xml]$Crumbs = Invoke-WebRequest “$URI/crumbIssuer/api/xml” ` -Method Get -Headers $Headers; $Headers.Add($Crumbs.defaultCrumbIssuer.crumbRequestField, ` $Crumbs.defaultCrumbIssuer.crumb); $Headers.Add(“Accept”, “application/xml”); $Result = Invoke-WebRequest -Uri “$URI/job/Test/build” ` -Method Post -Headers $Headers; } #-Main—————————————————————— Main #-Error Routine——————————————————— Trap { [System.Reflection.Assembly]::LoadWithPartialName(“System.Windows.Forms”) > $Null [Void] [System.Windows.Forms.MessageBox]::Show( ` $_.Exception.GetType().FullName + ` [System.Environment]::NewLine + ` “Error at line ” + $_.InvocationInfo.ScriptLineNumber + ` “ in ” + $_.InvocationInfo.ScriptName + ` [System.Environment]::NewLine + [System.Environment]::NewLine + ` $_.Exception.Message, “An Error Occurred”, 0) Exit } #-End——————————————————————-

And to close the circle you can call this PowerShell script from your eCATT script.

It is possible to execute Jenkins build processes from eCATT. Also you can get a result from the asynchronous build process for further operations of the eCATT test script.

It will be seen if this approach will work in practice. However, the prospect of this kind of integration itself is great.

Enjoy it.

Cheers
Stefan

  http://bit.ly/2EAAfir #SAP #SAPCloud #AI