Without a Swagger file the OOB REST external service cannot be generated, so you have three routes:
- Write the Swagger yourself - for the two or three operations you need, a 40-line Swagger 2.0 file (question 2739) is often faster than any custom code and gives you typed business objects and a Server definition; import it with External Service > Import from file. Tools like Postman ("Export as OpenAPI") or an example JSON response pasted into a schema generator produce the definitions.
- Call it from a script - BPMRESTRequest only addresses BPM's own API; for a foreign REST service use Java's HTTP client from the script (question 2888 has the reusable "REST Call" service) and JSON.parse the answer.
- Java integration - a small class with HttpURLConnection / Apache HttpClient in a managed jar; best when authentication is complex (OAuth2 with refresh, mutual TLS, signed requests).
// script task: GET with basic authentication, no Swagger
var url = tw.env.crmUrl + "/customers/" + encodeURIComponent(tw.local.customerId);
var con = new java.net.URL(url).openConnection();
con.setRequestProperty("Authorization", "Basic " + java.util.Base64.getEncoder().encodeToString(new java.lang.String(tw.env.crmUser + ":" + tw.env.crmPassword).getBytes("UTF-8")));
con.setRequestProperty("Accept", "application/json"); con.setConnectTimeout(10000); con.setReadTimeout(30000);
var rd = new java.io.BufferedReader(new java.io.InputStreamReader(con.getInputStream(), "UTF-8")), line, text = "";
while ((line = rd.readLine()) != null) text += line;
rd.close();
var json = JSON.parse(text);
tw.local.customer = new tw.object.Customer(); tw.local.customer.name = json.name; tw.local.customer.limit = json.creditLimit;BPM 8.5.7 note: the external service import expects Swagger 2.0 (OpenAPI 3 came with BAW 20.0.0.2), and TLS endpoints need their signer in the cell truststore (question 2743).
References