Run Publication Subscription REST API
Use the Data Integration Hub Run Publication Subscription REST API to run a specific publication or a specific subscription. You can run the publication or the subscription regardless of its mode, that is, you can run both enabled and disabled publications and subscriptions.
Note: You can use the Run Publication Subscription REST API to publish data and subscribe to data with publications and subscriptions that trigger a Data Integration task. You cannot use the API to publish data and subscribe to data with data-driven publications and subscriptions.
The Run Publication Subscription API returns the response code of the action that you perform. If the publication or subscription runs successfully, the API returns the event ID of the publication or the subscription event that Data Integration Hub generates. You can run the Data Integration Hub Event Status API to query the status of the publication or subscription event.
To run a publication or a subscription from the API, you must use a Data Integration Hub user with permissions and privileges for the publication or for the subscription that you want to run. For more information, see the Data Integration Hub Administrator Guide.
Sample Files
The <DIH_InstallationDir>\samples\rest_api_samples folder contains sample client applications and a readme file that describes the applications.
Run Publication Subscription REST API Request
Data Integration Hub uses different REST URLs for running a publication and for running a subscription.
To run a publication, use the following REST URL:
http://<DIH_console_host_port>/dih-console/api/v1/publication/start
For example:
http://localhost:18080/dih-console/api/v1/publication/start
To run a subscription, use the following REST URL:
http://<DIH_console_host_port>/dih-console/api/v1/subscription/start
For example:
http://localhost:18080/dih-console/api/v1/subscription/start
Note: The start subscription REST API does not support concurrent triggers of the same subscription. It is recommended that you trigger the subscription after a couple of seconds.
- Request syntax for running a publication
- To run a publication, use the following request syntax:
{
"publicationName": "<publicationName>",
"parameters": [
{"name": "param1", "value": "value"},
{"name": "param2", "value": "value"}
],
"paramFileContent": "<content of parameter file>",
"runPreprocess": "<true/false>",
"runDisabled": "<true/false>"
}
- The following list describes the elements of the request:
- - publicationName. Name of the publication to run.
- - parameters. Optional request parameters.
- - paramFileContent. Content of optional parameter file.
- - runPreprocess. Whether or not to run a publication pre-process before the publication runs.
- - runDisabled. Whether or not to run a publication that is in a Disabled status.
For example:
{
"publicationName": "daily_sales",
"parameters": [
{"name": "SRC_SAP", "value": "sapbw.etl-tools.info"},
{"name": "TGT_ORA", "value": "oracle_sap_staging"}
],
"paramFileContent": "[DWH_PROJECT.WF:wkf_daily_loading] \n $$platform=rh7",
"runPreprocess": "false",
"runDisabled": "true"
}
- Request syntax for running a subscription
- To run a subscription, use the following request syntax:
{
"subscriptionName": "<subscriptionName>",
"parameters": [
{"name": "param1", "value": "value"},
{"name": "param2", "value": "value"}
],
"paramFileContent": "<content of parameter file>",
"runDisabled": "<true/false>"
}
- The following list describes the elements of the request:
- - subscriptionName. Name of the subscription to run.
- - parameters. Optional request parameters.
- - paramFileContent. Content of optional parameter file.
- - runDisabled. Whether or not to run a subscription that is in a Disabled status.
For example:
{
"subscriptionName": "daily_report",
"parameters": [
{"name": "SRC_ORA", "value": "oracle_sap_staging"},
{"name": "SuccessEmail", "value": "customer@informatica.com"}
],
"paramFileContent": "[DWH_PROJECT.WF:wkf_daily_loading] \n $$platform=rh7",
"runDisabled": "true"
}
Run Publication Subscription REST API Action Response
When you use the Data Integration Hub Run Publication Subscription REST API to start the running of a publication or of a subscription, Data Integration Hub returns the response code of the action that you perform in the REST API response.
Running a publication or a subscription from the REST API returns one of the following response codes:
- •SUCCESS. Data Integration Hub triggered the publication or the subscription successfully. The status message includes the event ID of the publication or the subscription event that Data Integration Hub generates.
- •FAILED. Data Integration Hub could not trigger the publication or the subscription. The response provides the reason for the failure. For example, Data Integration Hub did not run the subscription because no publications are ready for consumption by the subscription.