- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
GenerateMappingCommand
Takes sample input and output documents and uses Amazon Bedrock to generate a mapping automatically. Depending on the accuracy and other factors, you can then edit the mapping for your needs.
Before you can use the AI-assisted feature for Amazon Web Services B2B Data Interchange you must enable models in Amazon Bedrock. For details, see AI-assisted template mapping prerequisites in the Amazon Web Services B2B Data Interchange User guide.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { B2biClient, GenerateMappingCommand } from "@aws-sdk/client-b2bi"; // ES Modules import
// const { B2biClient, GenerateMappingCommand } = require("@aws-sdk/client-b2bi"); // CommonJS import
const client = new B2biClient(config);
const input = { // GenerateMappingRequest
inputFileContent: "STRING_VALUE", // required
outputFileContent: "STRING_VALUE", // required
mappingType: "JSONATA" || "XSLT", // required
};
const command = new GenerateMappingCommand(input);
const response = await client.send(command);
// { // GenerateMappingResponse
// mappingTemplate: "STRING_VALUE", // required
// mappingAccuracy: Number("float"),
// };
Example Usage
GenerateMappingCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
inputFileContent Required | string | undefined | Provide the contents of a sample X12 EDI file (for inbound EDI) or JSON/XML file (for outbound EDI) to use as a starting point for the mapping. |
mappingType Required | MappingType | undefined | Specify the mapping type: either |
outputFileContent Required | string | undefined | Provide the contents of a sample X12 EDI file (for outbound EDI) or JSON/XML file (for inbound EDI) to use as a target for the mapping. |
GenerateMappingCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
mappingTemplate Required | string | undefined | Returns a mapping template based on your inputs. |
mappingAccuracy | number | undefined | Returns a percentage that estimates the accuracy of the generated mapping. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
AccessDeniedException | client | You do not have sufficient access to perform this action. |
InternalServerException | server | This exception is thrown when an error occurs in the Amazon Web Services B2B Data Interchange service. |
ThrottlingException | client | The request was denied due to throttling: the data speed and rendering may be limited depending on various parameters and conditions. |
ValidationException | client | Occurs when a B2BI object cannot be validated against a request from another object. |
B2biServiceException | Base exception class for all service exceptions from B2bi service. |