Taskflows > Taskflows > Running a taskflow as an API
  

Running a taskflow as an API

Before you run a taskflow as an API or schedule a taskflow, you must first publish the taskflow as a service.
When you publish a taskflow, Data Integration generates the service URL and the SOAP service URL. You can use these endpoint URLs to run the taskflow as an API. When you run a taskflow as an API, you can dynamically provide input parameters for the tasks that the taskflow contains and perform orchestration.
Note: When you run a taskflow from the taskflow designer, Data Integration automatically publishes the taskflow, and generates the service URL and SOAP service URL.
If you edit a published taskflow, you must publish the taskflow again for the changes to get reflected in the taskflow API.
To disable a taskflow API that was published as a service, you must unpublish the taskflow. After you make the necessary changes, publish the taskflow again for the changes to get reflected in the taskflow API.
    1. In Data Integration, select Explore.
    The Explore page opens.
    2. Navigate to the taskflow that you want to publish as a service and click Actions.
    3. From the Actions menu, select Publish as shown in the following image:
    The image shows the Publish option on the Actions menu.
    Data Integration publishes the taskflow as a service.
    Note: To unpublish the taskflow, select Unpublish from the Actions menu.
    4. From 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.
    5. To 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.
    6. To 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.
    1. Open the taskflow and click Actions > Properties Detail > Copy Service URL.
    2. Open 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
    3. Open 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"
}
}
}
    1. Open Postman.
    2. Select 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.
    3. Enter the user account details in the Authorization tab.
    4. Specify the swagger request in the Body tab as shown in the following image:
    The image shows the swagger request specified in the Body tab.
    5. Specify the input values in the request body.
    6. Click 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.