BPM, Workflow, and Case

 View Only

Recipe: Invoke IBM BPM/BAW REST API from Server Script Using LTPA Token

By Atanu Roy posted Mon September 13, 2021 09:33 AM

  
Overview

Skill Level: Beginner

This recipe would help with a sample code used to invoke REST API from server script with LTPA token.
In this example we will be retrieving error details of instances.

Ingredients

Knowledge of IBM BPM/BAW 

Step-by-step

  1. Use this snippet to invoke REST and retrieve error details

    var url = “https://yourserver:yourserverport/rest/bpm/wle/v1/process/errors?instanceIds=12345”;

    var ssoToken = Packages.com.ibm.websphere.security.web.WebSecurityHelper.getSSOCookieFromSSOToken();

    var httpClient = new Packages.org.apache.commons.httpclient.HttpClient();
    var method = new Packages.org.apache.commons.httpclient.method.PutMethod(url);
    method.setRequestHeader(new Packages.org.apache.commons.httpclient.Header(“Cookie”, “LtpaToken2=”+ssoToken.getValue()));

    var responseCode = String(httpClient.executeMethod(method));
    var response = method.getResponseBodyAsString();


#BusinessAutomationWorkflow(BAW)
#BusinessProcessManager(BPM)
#Recipe
#RESTAPI
0 comments
71 views

Permalink