Cloud Integration Hub > Cloud Integration Hub REST APIs > Consume Data REST API
  

Consume Data REST API

Use the Cloud Integration Hub Consume Data REST API to perform the following actions for API-based subscriptions:
The API can consume up to 2,000 events at a time. For example, to consume 5,000 published events, the first trigger of the subscription consumes the 2,000 oldest events, the second trigger consumes the next 2,000 oldest events, and the final trigger consumes the remaining 1,000 events.
You can't use the API with subscriptions that trigger a Data Integration task.
Note: When you use a private publication repository, if you change the Secure Agent on which the publication repository service runs or the port number of the publication repository, the URL of the API changes accordingly. In this case, be sure to notify API users and consumers of the new URL.

Consume Data REST API request

To consume data through the API, copy the URL of the API from the Subscription page in Cloud Integration Hub.

Request headers

Include the following headers in the Consume Data REST API request:
Accept - application/json
Content-Type - application/json
To support UTF-8 character encoding, for example, to use Japanese characters in table and column names, include the following headers in the request:
Accept: application/json;charset=utf-8
Accept-Charset: charset=utf-8
Content-Type: application/json;charset=utf-8

Request body

The syntax of the Consume Data REST API request body varies, based on the action you perform with the API.
Consume data
To consume data from a topic, use the following request syntax:
{
"aggregated": <value>
}
Where <value> takes one of the following values:
For example:
{
"aggregated": true
}
When you run multiple publications, you can add the publication event ID of a specific publication to the request body to consume only the data of the specific publication event. You can add only one publication event ID to the request body. The key "publicationEventId" is case sensitive. If you don't add the publication event ID of a specific publication to the request body, the subscription consumes all the available publication events.
To add the publication event ID of a specific publication event to the request, use the following syntax:
{
"publicationEventId" : "<publicationEventId>"
}
For example:
{
"publicationEventId" : "594210"
}
When you add the publication event ID of a specific publication to the request body, Cloud Integration Hub validates the key "publicationEventId" before it runs the subscription instance.
Reconsume data
To reconsume data that had previously been processed, use the following request syntax:
{
"requestType" : "RECONSUME",
"eventId" : "<subscriptionEventId>"
}
Where the key "eventId" is the subscription event ID to reconsume.
For example:
{
"requestType" : "RECONSUME",
"eventId" : "40559"
}
Reprocess subscription
To reprocess a failed subscription, use the following request syntax:
{
"requestType" : "REPROCESS",
"eventId" : "<subscriptionEventId>"
}
Where the key "eventId" is the subscription event ID to reprocess.
For example:
{
"requestType" : "REPROCESS",
"eventId" : "40577"
}

Consume Data REST API action response

When you use the Cloud Integration Hub Consume Data REST API to consume data directly from a topic, Cloud Integration Hub returns the response code of the action that you perform in the REST API response.
Consuming data through the REST API returns one of the following response codes:
SUCCESS
Cloud Integration Hub consumed the data successfully.
The response includes the consumed data in the following syntax:
{
"<table_name>":
[
{"<column_name>":"<data>"}
]
}
For example:
{
"Sales":
[
{"Opportunity_Name":"string”,"Opportunity_Owner_Id":"string"}
],
"Orders":
[
{"Account_Name":"string","Account_Id":"string","OrderId": "string"}
]
}
A SUCCESS response also includes the aggregated event ID of the subscription event that Cloud Integration Hub generates, the number of rows successfully processed, and the number of total rows processed.
FAILURE
Cloud Integration Hub could not consume the data. For example, if is there is no pending data for the subscription to consume. The response includes a description of the error that caused the failure.

Topic Swagger Structure for Consume Data REST API

The Consume Data REST API returns the Swagger structure for the topic from which the subscription consumes data.
To view the Swagger structure, copy the URL of the structure from the Subscription page in Cloud Integration Hub.