Use the h2h resource to create or run a hierarchical mapper to convert hierarchical data to a different hierarchical structure.
The h2h resource uses a hierarchical mapper ID in the URI. You can find the hierarchical mapper ID by opening the hierarchical mapper in the Data Integration user interface. In the URL, the last string of characters is the hierarchical mapper ID.
For example, in the URL https://dm-us.informaticacloud.com/diUI/products/integrationDesign/main/idsm/7sQJvjkeZLIfpWg6hpYwqJ/read, the hierarchical mapper ID is 7sQJvjkeZLIfpWg6hpYwqJ.
Creating a hierarchical mapper
To create a hierarchical mapper, send a POST request and specify the hierarchical mapper details.
POST request
Use the following URI to create the hierarchical mapper:
/h2h/api/v1/service/run/<hierarchical mapper ID>
The following table describes the fields in the POST request:
Field
Type
Description
name
String
Name of the hierarchical mapper.
description
String
Description of the hierarchical mapper.
projectName
String
Project folder where you want to save the hierarchical mapper.
projectFolderPath
String
Folder path within the project where you want to save the hierarchical mapper.
sourceXsd
String
Source XSD file, such as EDI832__20190322_140316_LOWECOR_0_0_0_0.xsd
sourceXsdDependencies
Array
List of dependencies for the source XSD file.
targetXsd
String
Target XSD file.
targetXsdDependencies
Array
Dependencies for the target XSD file.
sourceRoot
String
Name of the root element in the source.
targetRoot
String
Name of the root element in the target.
variables
Details about variables.
name
String
Variable name.
type
String
Variable data type.
list
String
Indicates whether to list the variable.
initialValue
String
Initial value of the variable.
statements
String
Comma-separated list of statements in the hierarchical mapper.
encodedService
String
Base64-encoded ZIP file that contains the source and target XSD files for the source and target schemas.
POST response
POST example
Running a hierarchical mapper
To run a hierarchical mapper, create a POST request and specify the XML data for the hierarchical mapper to process. You can provide the XML data as a buffer in the request body or as a file to pass to the hierarchical mapper. The output can be a buffer that is returned in the response, or you can write the output to a file.
POST request
Use the following URI to run the hierarchical mapper:
/h2h/api/v1/service/run/<hierarchical mapper ID>
The following table describes the fields in the POST request:
Field
Type
Description
agentGroupId
String
Runtime environment to run the hierarchical mapper.
input
Input details.
type
String
Type of input to send in the request body. Use buffer or file.
value
String
Input value to pass to the hierarchical mapper. If the input is a buffer, enter the XML data. If the input is a file, enter the path to the file.
output
Output details.
type
String
Type of output to receive in the response. Use buffer or file.
value
String
Output to receive in the response. If the output is a buffer, use an empty string. If the output is a file, enter the path to the file.
POST response
If successful, the hierarchical mapper returns the data in the target hierarchical structure.
The following table describes the fields in the response:
Field
Type
Description
output
String
Output value. The output is either a buffer or the path to a file.
message
String
Response message, such as Success.
POST request example for buffer to file
The following request runs a hierarchical mapper that converts XML data as a buffer and stores the converted data in an output file: