Taskflows > Taskflows > Running a taskflow as an API
  

Running a taskflow as an API

After you publish a taskflow as a service, you can run the taskflow as an API or schedule the taskflow. You can use the endpoint URLs to run the taskflow as an API, and dynamically provide input parameters for the tasks that the taskflow contains and perform orchestration.
    1Navigate to the taskflow that you published as a service.
    2From the Actions menu, select Properties Detail.
    The Properties Detail dialog box appears displaying the service URL and the SOAP service URL as shown in the following image:
    The image displays the Properties Detail dialog box with the service URL and the SOAP service URL.
    The service URL uses the following format:
    <Informatica Intelligent Cloud Services URL>/active-bpel/rt/<API_name>
    The SOAP service URL uses the following format:
    <Informatica Intelligent Cloud Services URL>/active-bpel/soap/<API_name>
    You can also view the associated Swagger file and WSDL file.
    3To run the taskflow, perform one of the following steps based on the type of client that you want to use:
    You can pass inputs using the service URL through a browser or a third-party tool. For more information, see Passing inputs through a browser or Passing inputs through a REST client.
    You receive the taskflow run ID as the response.
    4To monitor the taskflow with the run ID, perform one of the following steps:

Passing inputs through a browser

When you run a taskflow as an API, you can pass inputs using the endpoint URLs through a browser.
    1Open the taskflow and click Actions > Properties Detail > Copy Service URL.
    2Open a text editor and add the input field and value to the service URL as shown below:
    <Informatica Intelligent Cloud Service URL>/active-bpel/rt/<API_name>?<inputfield>=<value>
    For example: https://na1.dm-us.informaticacloud.com/active-bpel/rt/Taskflow?CustomerName=TestConsumer
    To pass values for more than one field, use & to separate the input fields as shown below:
    https://na1.dm-us.informaticacloud.com/active-bpel/rt/Taskflow?CustomerName=TestConsumer&CustomerEmail=testconsumer@mailinator.com&ItemName=item1&ItemCount=2
    3Open a browser and paste the service URL with the input fields and values. If the taskflow uses authentication, you must enter the allowed user name and password.
    The service returns the taskflow run ID as the response. You can monitor the taskflow execution by using the run ID.

Passing inputs through a REST client

When you have multiple input values to pass and have a complex body, you can use a REST client such as Postman. You must use the service URL and the API definition available in the Swagger file to send a request through a REST client. The Swagger file contains the operation name, authentication method, and the input for the taskflow. You can use the Swagger editor to parse the Swagger file and get the Swagger request.
The following is a sample swagger request:
{
"input": "ACCOUNT.csv",
"inputConn": {
"input": {
"source": {
"Source": {
"object": "RetailCustomer",
"connection": "0100000B000000000004"
}
},
"connectionNameParam": "ACCOUNT.csv"
}
}
}
    1Open Postman.
    2Select the HTTP verb such as GET or POST and specify the generated REST service URL as shown in the following image:
    The image shows the HTTP verb and the REST service URL specified in Postman.
    3Enter the user account details in the Authorization tab.
    4Specify the swagger request in the Body tab as shown in the following image:
    The image shows the swagger request specified in the Body tab.
    5Specify the input values in the request body.
    6Click Send.
    You receive the taskflow run ID as the response as shown in the following image:
    The image shows the taskflow run ID as the response. You can monitor the taskflow execution by using the run ID.

Resume a suspended taskflow

You can use the resumeWithFaultRetry resource to resume a suspended taskflow instance from a faulted step. You can also use the resumeWithFaultSkip resource to skip a faulted step and resume a suspended taskflow instance from the next step.

resumeWithFaultRetry

To resume a suspended taskflow instance from a faulted step, use the following URI in a PUT request:
PUT <Informatica Intelligent Cloud Services URL>/active-bpel/management/runtime/v1/resumeWithFaultRetry/<run ID>
Include the following information in the request:
Field
Type
Required
Description
run ID
String
Yes
Run ID for the taskflow.
resumeWithFaultRetry PUT example
Use this sample as a reference to resume a suspended taskflow instance from a faulted step in a PUT request.
PUT https://na1.dm-us.informaticacloud.com/active-bpel/management/runtime/v1/resumeWithFaultRetry/681134580186693632
Accept: application/json
INFA-SESSION-ID: 9KA11tLGqxVcGeul8SQBK3
resumeWithFaultRetry PUT response
Returns the 204 response code if the request is successful.
Returns an error object if error occurs.

resumeWithFaultSkip

To skip a faulted step and resume a suspended taskflow instance from the next step, use the following URI in a PUT request:
PUT <Informatica Intelligent Cloud Services URL>/active-bpel/management/runtime/v1/resumeWithFaultSkip/<run ID>
Include the following information in the request:
Field
Type
Required
Description
run ID
String
Yes
Run ID for the taskflow.
resumeWithFaultSkip PUT example
Use this sample as a reference to skip a faulted step and resume a suspended taskflow instance from the next step in a PUT request.
PUT https://na1.dm-us.informaticacloud.com/active-bpel/management/runtime/v1/resumeWithFaultSkip/681134580186693632
Accept: application/json
INFA-SESSION-ID: 9KA11tLGqxVcGeul8SQBK4
resumeWithFaultSkip PUT response
Returns the 204 response code if the request is successful.
Returns an error object if error occurs.

Listing suspended taskflows through an API

You can use a JLS API to get a list of taskflows that are suspended. By default, the number of suspended taskflows that the API returns is 200.
To get a list of suspended taskflows, use the following URI:
{{<Informatica Intelligent Cloud Services URL>}}/jls-di/api/v1/Orgs(<Organization ID>)/JobLogEntries?$top=<Number of suspended taskflows>&$filter=(status eq 'SUSPENDED' and assetType eq 'TASKFLOW')
To get a list of latest suspended taskflows within an organization based on the users who started the taskflows, use the following URI :
{{<Informatica Intelligent Cloud Services URL>}}/jls-di/api/v1/Orgs(<Organization ID>)/JobLogEntries?$top=<Number of suspended taskflows>&$filter=(status eq 'SUSPENDED' and startedBy eq '<username>' and assetType eq 'TASKFLOW')

Terminating taskflows through an API

You can terminate one or more taskflows using an API. The maximum number of taskflows that you can terminate at a time is 200.
Use the following URI to terminate one or more taskflows:
PUT <Informatica Intelligent Cloud Services URL>/active-bpel/services/tf/terminate
Enter the taskflow run IDs as the input in the body of the PUT request.
Enclose the run IDs within double quotation marks and separate multiple run IDs with a comma. For example, enter: < { "runid" : [ "7645954072982472420" , "675348537035183518"] } >.
The API displays error messages when you enter a run ID that does not exist or is not valid. The API supports basic authentication and session ID authorization.
The following image shows a sample terminate request and response:
The image shows a sample terminate request and response.