App Connect

App Connect

Join this online user group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only

Automate App Connect bar file operation - replace using Open APIs for App Connect on CP4I

By ABHINAV PRIYADARSHI posted 13 hours ago

  

Create App Connect Dashboard instance in CP4I.

Once the App Connect Dashboard is in ready state you will get Dashboard UI and Keycloak UI shown below.

A screenshot of a computer

AI-generated content may be incorrect.

To get the credential to Login to keycloak administration,

Got to ibm-common-services namespace à Secrets à cs-keycloak-initial-admin à get the user name (temp-admin) and its password.

A screenshot of a computer

AI-generated content may be incorrect.

Now, Login to keycloak link present in the ACE Dashboard using temp-admin user and its password

Goto Manage realms à Switch to cloudpak realm

A screenshot of a computer

AI-generated content may be incorrect.

Goto Users

Add user

fd-apiuser

A screenshot of a computer

AI-generated content may be incorrect.

Got to credentials tab and reset password.

A screenshot of a computer

AI-generated content may be incorrect.

Goto Role Mapping à

Assign role for fp-apiuser for ACE dashboard-viewer and dashboard-admin as shown below

A screenshot of a computer

AI-generated content may be incorrect.

You are ready to invoke the App Connect APIs provided by Open API to replace a bar file, More details about the Open APIs are mentioned in the below link.

IBM Documentation - IBM Documentation

To invoke any App Connect API using Postman, you need Authentication token from App Connect.

To get token invoke <ace dashboard endpoint url>/api/v1/token endpoint as shown in the below postman collect.

A screenshot of a computer

AI-generated content may be incorrect.

 Use the token to add Authorization Header of type Bearer Token

A screenshot of a computer

AI-generated content may be incorrect.

In the body select binary data, attach the bar file and send the put request.

A screenshot of a computer

AI-generated content may be incorrect.

In the response you will get the bar file name which is replaced and the bar file URL. 

The same steps could you executed using curl command when can be used in the CICD automation if you are using shell script to replace the bar file. 

Request to get the API authentication token:

$curl -X POST https://ace-dashboard-api-ace.apps.683c2df2ec0b6afad3e9e70d.ap1.techzone.ibm.com/api/v1/tokens --user fd-apiuser:Passw0RD@012345

Response:

{"accessToken":"eyJhbGciOiJIUzUxMiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI3ZDc2NTgyMS1iZjZlLTQ2OTctOGY4ZC0yNjFlNDkzOWQ2ODQifQ.eyJpYXQiOjE3NDg4NTg4MTQsImp0aSI6ImM3OTU0M2Y5LTJiNjMtNDk1ZS1hZWM3LTBkMTc4Yzk4NjY5ZCIsImlzcyI6Imh0dHBzOi8va2V5Y2xvYWstaWJtLWNvbW1vbi1zZXJ2aWNlcy5hcHBzLjY4M2MyZGYyZWMwYjZhZmFkM2U5ZTcwZC5hcDEudGVjaHpvbmUuaWJtLmNvbS9yZWFsbXMvY2xvdWRwYWsiLCJhdWQiOiJodHRwczovL2tleWNsb2FrLWlibS1jb21tb24tc2VydmljZXMuYXBwcy42ODNjMmRmMmVjMGI2YWZhZDNlOWU3MGQuYXAxLnRlY2h6b25lLmlibS5jb20vcmVhbG1zL2Nsb3VkcGFrIiwidHlwIjoiT2ZmbGluZSIsImF6cCI6ImRhc2gtYWNlLWFjZS1kYXNoYm9hcmQtNWM4MjgiLCJzaWQiOiI4NzRmNzFiZC1jYTJjLTQxZjUtOTk2MS1hMGEyYTllOTA0OWYiLCJzY29wZSI6Im9wZW5pZCBlbWFpbCBvZmZsaW5lX2FjY2VzcyBzZXJ2aWNlX2FjY291bnQgcHJvZmlsZSBhY3IifQ.sawKv45GSB4nHiesiIcDliLigMxzXFCBKpD8r2NbLbfzkYTHrKfQZl-zWAgizGNReWmOhqUOhunnO0C7vyoG-A"}

Request to replace the bar file:

Use the bearer token from the about output in the below command to replace the bar file.

$ curl -X PUT https://ace-dashboard-api-ace.apps.683c2df2ec0b6afad3e9e70d.ap1.techzone.ibm.com/api/v1/bar-files/test_circuitbreaker -H "Content-Type: application/octet-stream" --header "Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI3ZDc2NTgyMS1iZjZlLTQ2OTctOGY4ZC0yNjFlNDkzOWQ2ODQifQ.eyJpYXQiOjE3NDg4NTg4MTQsImp0aSI6ImM3OTU0M2Y5LTJiNjMtNDk1ZS1hZWM3LTBkMTc4Yzk4NjY5ZCIsImlzcyI6Imh0dHBzOi8va2V5Y2xvYWstaWJtLWNvbW1vbi1zZXJ2aWNlcy5hcHBzLjY4M2MyZGYyZWMwYjZhZmFkM2U5ZTcwZC5hcDEudGVjaHpvbmUuaWJtLmNvbS9yZWFsbXMvY2xvdWRwYWsiLCJhdWQiOiJodHRwczovL2tleWNsb2FrLWlibS1jb21tb24tc2VydmljZXMuYXBwcy42ODNjMmRmMmVjMGI2YWZhZDNlOWU3MGQuYXAxLnRlY2h6b25lLmlibS5jb20vcmVhbG1zL2Nsb3VkcGFrIiwidHlwIjoiT2ZmbGluZSIsImF6cCI6ImRhc2gtYWNlLWFjZS1kYXNoYm9hcmQtNWM4MjgiLCJzaWQiOiI4NzRmNzFiZC1jYTJjLTQxZjUtOTk2MS1hMGEyYTllOTA0OWYiLCJzY29wZSI6Im9wZW5pZCBlbWFpbCBvZmZsaW5lX2FjY2VzcyBzZXJ2aWNlX2FjY291bnQgcHJvZmlsZSBhY3IifQ.sawKv45GSB4nHiesiIcDliLigMxzXFCBKpD8r2NbLbfzkYTHrKfQZl-zWAgizGNReWmOhqUOhunnO0C7vyoG-A" --data-binary @/c/Users/912904744/IBM/ACET12/workspace/BARfiles/test_circuitbreaker.bar

Response:

{"name":"test_circuitbreaker.bar","url":"https://ace-dashboard-dash.ace:3443/v1/directories/test_circuitbreaker?4559ca90-a31a-4da7-b37e-1e2724dc1a37"}

The bar file is replaced successfully, if you get the bar url and name of the file in the output with 200 ok HTTP Response.

Conclusion:

There are different ways to list, get, replace, delete a bar file from the integration server in App Connect Dashboard running on CP4I. The article shows how to automate these using REST APIs provide by open API for App Connect. These automation would be helpful to implement CICD pipeline for App Connect on CP4I.

References:

Sample scenario for invoking the API for IBM App Connect in containers (Red Hat OpenShift) - IBM Documentation

IBM Documentation - IBM Documentation

Implementing identity and access management in IBM App Connect by using a managed Keycloak solution on Red Hat OpenShift - IBM Documentation

0 comments
1 view

Permalink