Skip to content

Instantly share code, notes, and snippets.

@damithsj
Created February 19, 2024 11:51
Show Gist options
  • Save damithsj/5adcfda4e6367747be0a134645f0db0e to your computer and use it in GitHub Desktop.
Save damithsj/5adcfda4e6367747be0a134645f0db0e to your computer and use it in GitHub Desktop.
Send Data to a REST API using IFS Workflow
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn">
<bpmn:process id="TestWfSendToRestAPI" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_010w4hh</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:serviceTask id="Activity_1p3jku4" name="Send to REST API" camunda:class="com.ifsworld.fnd.bpa.delegate.IfsHttpConnectionDelegate">
<bpmn:extensionElements>
<camunda:inputOutput>
<camunda:inputParameter name="ifsBpaHttpConnectionMethod">POST</camunda:inputParameter>
<camunda:inputParameter name="ifsBpaHttpConnectionUrl">https://YOUR_MOCK_SERVER.mock.pstmn.io/PostmanPost</camunda:inputParameter>
<camunda:inputParameter name="ifsBpaHttpConnectionBody">{
"CustomerId": "${CustomerId}",
"Name": "${Name}"
}</camunda:inputParameter>
<camunda:inputParameter name="ifsBpaHttpConnectionOutputs">
<camunda:map>
<camunda:entry key="_apiResponse">$.apiResponse</camunda:entry>
</camunda:map>
</camunda:inputParameter>
<camunda:inputParameter name="ifsBpaHttpConnectionHeaders">
<camunda:map>
<camunda:entry key="Content-Type">application/json</camunda:entry>
</camunda:map>
</camunda:inputParameter>
<camunda:inputParameter name="ifsBpaRestResponseVariableName">_Response</camunda:inputParameter>
<camunda:inputParameter name="ifsBpaRestResponseCheck" />
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>Flow_19x44pc</bpmn:incoming>
<bpmn:outgoing>Flow_0gznou1</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="Flow_010w4hh" sourceRef="StartEvent_1" targetRef="Activity_1v77x97" />
<bpmn:serviceTask id="Activity_1v77x97" name="Get Customer Data" camunda:class="com.ifsworld.fnd.bpa.IfsProjectionDelegate">
<bpmn:extensionElements>
<camunda:inputOutput>
<camunda:inputParameter name="ifsBpaProjectionAction">READ</camunda:inputParameter>
<camunda:inputParameter name="ifsBpaProjectionETagVariableName">ETag</camunda:inputParameter>
<camunda:inputParameter name="ifsBpaProjectionName">CustomerHandling</camunda:inputParameter>
<camunda:inputParameter name="ifsBpaProjectionEntitySetName">CustomerInfoSet</camunda:inputParameter>
<camunda:inputParameter name="ifsBpaProjectionNestedEntityParameters">
<camunda:map />
</camunda:inputParameter>
<camunda:inputParameter name="ifsBpaProjectionParameters">
<camunda:map>
<camunda:entry key="CustomerId">${CustomerId}</camunda:entry>
</camunda:map>
</camunda:inputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>Flow_010w4hh</bpmn:incoming>
<bpmn:outgoing>Flow_19x44pc</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="Flow_19x44pc" sourceRef="Activity_1v77x97" targetRef="Activity_1p3jku4" />
<bpmn:sequenceFlow id="Flow_0gznou1" sourceRef="Activity_1p3jku4" targetRef="Activity_0xfznad" />
<bpmn:userTask id="Activity_0xfznad" name="User Information Message" camunda:formKey="User Message">
<bpmn:extensionElements>
<camunda:formData>
<camunda:formField id="_apiResponse" type="string">
<camunda:properties>
<camunda:property id="readonly" value="true" />
</camunda:properties>
</camunda:formField>
</camunda:formData>
<camunda:inputOutput>
<camunda:inputParameter name="ifsBpaImpl_apiResponse">
<camunda:map>
<camunda:entry key="en">API Response</camunda:entry>
</camunda:map>
</camunda:inputParameter>
<camunda:inputParameter name="ifsBpaUserTaskIsHeader">true</camunda:inputParameter>
<camunda:inputParameter name="ifsBpaUserTaskHeaderLocale">
<camunda:map>
<camunda:entry key="en">API Response Message</camunda:entry>
</camunda:map>
</camunda:inputParameter>
<camunda:inputParameter name="ifsBpaUserTaskIsCancel">true</camunda:inputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>Flow_0gznou1</bpmn:incoming>
<bpmn:outgoing>Flow_0ah0a30</bpmn:outgoing>
</bpmn:userTask>
<bpmn:endEvent id="Event_0nyxzct">
<bpmn:incoming>Flow_0ah0a30</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_0ah0a30" sourceRef="Activity_0xfznad" targetRef="Event_0nyxzct" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="TestWfSendToRestAPI">
<bpmndi:BPMNEdge id="Flow_0ah0a30_di" bpmnElement="Flow_0ah0a30">
<di:waypoint x="750" y="254" />
<di:waypoint x="842" y="254" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0gznou1_di" bpmnElement="Flow_0gznou1">
<di:waypoint x="560" y="254" />
<di:waypoint x="650" y="254" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_19x44pc_di" bpmnElement="Flow_19x44pc">
<di:waypoint x="390" y="254" />
<di:waypoint x="460" y="254" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_010w4hh_di" bpmnElement="Flow_010w4hh">
<di:waypoint x="218" y="254" />
<di:waypoint x="290" y="254" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="182" y="236" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_04gi2g3_di" bpmnElement="Activity_1p3jku4">
<dc:Bounds x="460" y="214" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_14bzm72_di" bpmnElement="Activity_1v77x97">
<dc:Bounds x="290" y="214" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0ltv0o5_di" bpmnElement="Activity_0xfznad">
<dc:Bounds x="650" y="214" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0nyxzct_di" bpmnElement="Event_0nyxzct">
<dc:Bounds x="842" y="236" width="36" height="36" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment