Inbound API Stage
The Inbound API stage allows messages to be ingested into Integration Hub from an external source, via an API call.
Stage Overview
The Inbound API stage allows messages to be ingested into Integration Hub from an external source, via an API call.
Stage Definition File Location
All Inbound API stages are defined by creating an appropriately formatted JSON definition file in the following location:
Stage JSON Definition File Format
The JSON definition file for an Inbound API stage is as follows:
{
"name": "api-name",
"operation": "operation-name",
"displayName": "Brief Stage Title",
"description": "Brief description of the stage.",
"enabled": "$env:STATUS_<INTEGRATION_NAME>",
"concurrency": 10,
"httpMethod": "GET|POST|PUT|PATCH|DELETE",
"httpParametersMode": "none|parameter|REST",
"externalApiUrlPath": "/{rest}/{params}",
"publicAPI": false,
"publicAuth": {
// See Public Authentication Options section below...
},
"schemaFilename": "schemas/path/to/schema/schema-name.json",
"contentType": "json",
"discardEmptyPayloads": false,
"leaseLockName": "lock-name",
"deduplicate": {
"timeWindow": "HH:MM:SS",
"schemaMessageId": "schemas/path/to/transform.liquid"
},
"preLogTransformSchemaFileName": "schemas/path/to/schema/schema-name.liquid",
"preLogTransformSchemaType": "liquid|javascript",
"preLogTransformFormat": "json|xml|csv"
}
| Property | Sub-Property | Description |
|---|---|---|
name | The API part of the stage name. See API Interface stage names. | |
operation | The Operation part of the stage name. See API Interface stage names. | |
displayName | Optional (but highly recommended). A short (3 or 4 word) "display name" for the stage, used as a "title" of the stage in the Integration Hub Portal service's self-documentation capability. | |
description | Optional (but highly recommended). A brief (10 to 15 word) description of the stage, used as a brief description of the stage's purpose in the Integration Hub Portal service's self-documentation capability. For a more detailed explanation (when needed), use the stage markdown feature. | |
enabled | Optional boolean flag (true or false). Default is true. Generally set via a DevOps variable. Controls if the stage is deployed enabled or not. | |
concurrency | Optional number of concurrent runs permitted for the stage. Default is 10. | |
httpMethod | Optional REST method that the inbound API stage should be exposed as. One of GET, POST, PUT, PATCH, or DELETE. Default is POST. | |
httpParametersMode | Optionally defines if the inbound API supports passing parameters. Default is none.See the Handling Inbound Parameters section below for more details. | |
externalApiUrlPath | When the httpParametersMode value is set to REST, the externalApiUrlPath defines the REST parameter structure that must be included when calling the API.See the Handling Inbound Parameters section below for more details. | |
publicAPI | Optional boolean flag (true or false). Default is false. When true, the API will not require an API Management subscription key to call the stage's API endpoint. See also the publicAuth option below. | |
publicAuth | Optional object for enabling alternate API authentication options when publicAPI is set to true, and the standard API Management subscription key authentication has been disabled.See the Public Authentication Options section below. | |
schemaFilename | A filename that defines the Inbound API schema. See below for more details on the schema file location and format. | |
contentType | The incoming message payload format for the Inbound API. Either json or xml. | |
discardEmptyPayloads | Optional boolean flag (true or false). Default is false. When true, if the payload received by the API is an empty string, an empty JSON object (i.e. {}), or an empty JSON array (i.e. []), then the stage will "discard" the payload by not emitting an event to trigger further processing. | |
leaseLockName | Optional. See Lease Locking. | |
deduplicate | Inbound message de-duplication options, to allow incoming duplicate messages to be discarded. | |
timeWindow | The time window in which any duplicate payloads detected should be discarded. (Hours, minutes, and seconds.) | |
schemaMessageId | A filename that defines a Liquid transform, which will transform the received payload into a text string, which defines a unique ID for each message, allowing any duplicates of this unique ID received within the timeWindow to be discarded. |
Pre-Logging Transformation
This stage supports the optional pre-logging transformation feature using the following fields:
preLogTransformSchemaFileNamepreLogTransformSchemaTypepreLogTransformFormat
See the Pre-Logging Transformation for details.
Handling Inbound Parameters
By default, an Inbound API stage does not accept either URL or REST parameters as part of the API's URL.
However, this can be changed by the httpParametersMode setting, to allow either Classic URL parameters (using the parameter option), or REST parameters (using the REST option).
Classic URL Parameters
When the httpParametersMode value is set to parameter, the deployed Inbound API will allow any value and number of classic URL parameters to be included when calling the created API endpoint.
With these settings in place, the payload that is output from the stage will include these classic URL parameters in the payload. For example, if an API defined in this way is called with the following URL parameters:
?filter=userName eq Test_User&caseSensitive=true
then the output payload from the stage would be:
{
"queryParameters": {
"filter": "userName%20eq%20Test_User",
"caseSensistive": "true"
},
"payload": {
// HTTP Payload (POST, PUT, PATCH only)
}
}
REST Parameters
When the httpParametersMode value is set to REST, the deployed Inbound API will require that the API is called with a defined set of REST parameters.
The parameters required are defined by the externalApiUrlPath setting.
For example, if the httpParametersMode value is set to REST, and the externalApiUrlPath value is set to /{rest}/{params}, then the API would need two REST parameters added to the complete API URL when called. These would then be included in the output payload from the stage:
{
"pathParameters": {
"rest": "VALUE OF THE FIRST REST PARAM",
"params": "VALUE OF THE SECOND REST PARAM"
},
"payload": {
// HTTP Payload (POST, PUT, PATCH only)
}
}
Tracing Requests from Other Systems
Integration Hub gives each run a correlation ID. All stages of the run use it, and the Portal Search page shows it. By default, Integration Hub makes a new correlation ID for each request.
To trace a request from the calling system (for example an Azure Logic App) into Integration Hub, send your own correlation ID in the x-klv-ih-client-tracking-id HTTP header. Integration Hub then uses that value as the correlation ID for the run.
The x-klv-ih-client-tracking-id value must be different for each request. Integration Hub uses the correlation ID to store the payloads of the run. When two requests have the same value, the payload of one request overwrites the payload of the other, and payloads are lost or duplicated.
Integration Hub ignores the x-ms-client-tracking-id HTTP header. An Azure Logic App HTTP action sends this header by default, and when the Logic App uses "Split On", all of the split runs send the same value. To trace a call from a Logic App, set the x-klv-ih-client-tracking-id header to a value that is different for each call, for example @{guid()}.
Public Authentication Options
When the publicAPI option is set to true, the API does not require an API Management subscription key to call the stage's API endpoint.
An Inbound API stage can simply be deployed this way, if desired, allowing any system to call the API endpoint without any form of authentication.
However, Integration Hub also supports applying other forms of authentication to the API endpoint, when the default of using an API Management subscription key is not sufficient.
The publicAuth values tenantId, applicationId, issuerSigningKeys, value and fieldValue are secrets, and are stored in Key Vault. Each value must be an $env: token for an Azure DevOps variable, or a $kv: token for a Key Vault secret. issuerSigningKeys can also be a comma-separated list of $env: and $kv: tokens. The headerName is not a secret: it can be a literal header name, or one $env: or $kv: token. See Stage Secrets.
OAuth 2.0 Authentication
To use OAuth 2.0 authentication, configure the publicAPI and publicAuth options as follows:
{
"publicAPI": true,
"publicAuth": {
"type": "oauth2.0",
"tenantId": "$env:TENANT_ID",
"applicationId": "$env:APPLICATION_ID",
"issuerSigningKeys": "$env:BASE64_ENCODED_KEYS"
}
}
| Property | Description |
|---|---|
type | Set to oauth2.0 to configure OAuth 2.0 authentication on the public API endpoint. |
tenantId | The Azure Entra ID Tenant ID that will be used to authenticate the caller. Must be a GUID. |
applicationId | The Azure App Registration ID in the above Tenant that will be used to authenticate the caller. Must be a GUID. |
issuerSigningKeys | An optional, comma-separated list of Base64 encoded issuer signing keys. If the JWT being supplied when calling the API has not been signed by a standard Azure issuer signing key, one or more alternate signing keys can be supplied this way. Each entry in the list must be an $env: or $kv: token, for example $kv:dm1-old-signing-key, $env:NEW_SIGNING_KEYS. An $env: variable can hold one key, or several comma-separated keys. Mixing the two kinds of token is useful when you rotate a key. |
When configured, the calling system must include a valid JWT that has been issued for the specified App Registration in the specified Tenant, in the Authorization header of the API call.
HMAC SHA256 Authentication
HMAC SHA256 authentication is a common approach to API authentication for webhook callbacks.
To use HMAC SHA256 authentication, configure the publicAPI and publicAuth options as follows:
{
"publicAPI": true,
"publicAuth": {
"type": "HMACSHA256",
"value": "$env:SECRET_VALUE",
"headerName": "$env:HTTP_HEADER_NAME"
}
}
| Property | Description |
|---|---|
type | Set to HMACSHA256 to configure HMAC SHA256 authentication on the public API endpoint. |
value | The shared secret value that is used to generate the SHA256 digest. |
headerName | The name of the HTTP header that the SHA256 digest is provided in by the remote system. |
JSON Field Authentication
Incoming API calls to Integration Hub can also be authenticated based on a field value of the incoming payload (JSON payloads only).
{
"publicAPI": true,
"publicAuth": {
"type": "jsonFieldValue",
"fieldName": "[\"field1\"][\"field2\"]",
"fieldValue": "$env:SECRET_VALUE"
}
}
| Property | Description |
|---|---|
type | Set to jsonFieldValue to configure JSON field authentication on the public API endpoint. |
fieldName | A JSON-path description of which field value to use for authentication. |
fieldValue | The expected value of fieldName. |
Schema Definition File Location
The schemaFilename must be defined using a directory path based on the root of the Integration Hub service folder. It is recommended that this always starts with the directory schemas, and that schema definitions are stored in a logical structure that allows easy reuse where required.
Schema Definition File Format
JSON APIs
To define a JSON-based Inbound API stage, the following file format is used:
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier."
},
"object": {
"type": "string",
"description": "Object identifier."
},
"api_version": {
"type": "string",
"description": "API version."
},
"data": {
"type": "array",
"description": "Data array.",
"items": {
"type": "object",
"properties": {
// etc.
}
}
}
},
"required": [
"id",
"object",
"api_version"
],
"example": {
"id": "b8855b8c-b3e2-11ec-b909-0242ac120002",
"object": "invoice.object",
"api_version": "1.0.0",
"data": [
// ...
]
}
}
This definition file would accept a payload in the following format, even though there is no data field containing an array, because the data array element of the payload definition is not listed as being required.
{
"id": "123456789",
"object": "abcd",
"api_version": "1.0.0"
}
However, the following payload would not be accepted, as the api_version field is missing, even though it is defined as required.
{
"id": "123456789",
"object": "abcd"
}
XML APIs
To define an XML-based Inbound API stage, a standard XSD file is used. For example:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="object">
<xs:complexType>
<xs:sequence>
<xs:element name="id" type="xs:string" />
<xs:element name="object" type="xs:string" />
<xs:element name="api_version" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>Last updated on