BPM, Workflow, and Case

 View Only

 External service update - Swagger file name

Yannick Martin's profile image
Yannick Martin posted Wed January 08, 2025 04:33 AM

Hi,

we would like to identify the swagger file name used in an existing external service to update it.

See official documentation : https://www.ibm.com/docs/en/baw/22.x?topic=service-invoking-rest

If the swagger fie name isn't the same than used previously, a new service (and data, ....) are automatically created.

Is there a way to retrieve the swagger file name of an external rest service ?

Thanks for help

Yannnick

Sebastian Tylko's profile image
Sebastian Tylko

Hi, 

This is I believe not easily visible anywhere. 
However I have found way to get it using Process Designer API.  

To do that you need 2 IDs: containerRef and external service assetId
containerRef is easy - this is what you see at the end of your WebPD url.

e.g  https://bawSystem:port/WebPD/jsp/bootstrap.jsp?containerRef=2063.3dffc787-623c-4f48-842f-477683b95f3b 

For assetId - I don't have any better solution than query in BPM database:

 SELECT   '1.' || PO_ID AS AssetId
    FROM   LSW_PO_VERSIONS
  WHERE  PO_NAME = 'YourRESTServiceName' AND END_SEQ_NUM = 999999999999 
    WITH   UR;

what returns something like:  
AssetId
--------------------------------------
1.b3cd98fc-ac8c-47c6-a6fd-552d60dccd6e

Now you can create URL like below: 

https://bawSystem:port/rest/bpm/wle/pd/v1/asset/assetId?containerRef=containerRef 

e.g.

https://bawSystem:port/rest/bpm/wle/pd/v1/asset/1.b3cd98fc-ac8c-47c6-a6fd-552d60dccd6e?containerRef=2063.3dffc787-623c-4f48-842f-477683b95f3b 

Execute HTTP GET call  (using Browser, Curl, Postman ...)

You need  only basic authentication for this call and it should return JSON response.
Look for descriptorSrcLocation element under restBinding:
 
...
"extensionElements": 
  {"externalService": [
    {
    "cachingType": false,
    "name": "YourRESTServiceName",
    "declaredType": "com.ibm.bpmsdk.model.bpmn20.ibmextservice.TExternalService",
        "restBinding":                   {
          "descriptorSrcLocation": "YourServiceFileNameIsHere.yaml",
...

-- 
Sebastian Tylko

Sebastian Tylko's profile image
Sebastian Tylko

+ EDIT1: With that call:    
       GET https://bawSystem:port/rest/bpm/wle/pd/v1/assets?containerRef=containerRef
       you can get all assets including assetId  (poId)
       Then you don't need database query at all.
       ...
      "EXTERNALSERVICE":       {
         "displayName": "External Service",
         "poSubType": ["EXTERNALSERVICE"],
         "poType": "BPMService",
         "items":          
            [
                {
               "isGhost": false,
               "bindingType": "restBinding",
               "requiresMigration": false,
               "poId": "1.b3cd98fc-ac8c-47c6-a6fd-552d60dccd6e

          ...

-- 
Sebastian Tylko

Yannick Martin's profile image
Yannick Martin

Thanks Sebastian.

Sachin Jain's profile image
Sachin Jain

Thanks , this was really helpful.