TestParsing
Parses the input EDI (electronic data interchange) file. The input file has a file size limit of 250 KB.
Request Syntax
{
"advancedOptions": {
"x12": {
"splitOptions": {
"splitBy": "string
"
},
"validationOptions": {
"validationRules": [
{ ... }
]
}
}
},
"ediType": { ... },
"fileFormat": "string
",
"inputFile": {
"bucketName": "string
",
"key": "string
"
}
}
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters.
The request accepts the following data in JSON format.
- advancedOptions
-
Specifies advanced options for parsing the input EDI file. These options allow for more granular control over the parsing process, including split options for X12 files.
Type: AdvancedOptions object
Required: No
- ediType
-
Specifies the details for the EDI standard that is being used for the transformer. Currently, only X12 is supported. X12 is a set of standards and corresponding messages that define specific business documents.
Type: EdiType object
Note: This object is a Union. Only one member of this object can be specified or returned.
Required: Yes
- fileFormat
-
Specifies that the currently supported file formats for EDI transformations are
JSON
andXML
.Type: String
Valid Values:
XML | JSON | NOT_USED
Required: Yes
- inputFile
-
Specifies an
S3Location
object, which contains the Amazon S3 bucket and prefix for the location of the input file.Type: S3Location object
Required: Yes
Response Syntax
{
"parsedFileContent": "string",
"parsedSplitFileContents": [ "string" ],
"validationMessages": [ "string" ]
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- parsedFileContent
-
Returns the contents of the input file being tested, parsed according to the specified EDI (electronic data interchange) type.
Type: String
- parsedSplitFileContents
-
Returns an array of parsed file contents when the input file is split according to the specified split options. Each element in the array represents a separate split file's parsed content.
Type: Array of strings
- validationMessages
-
Returns an array of validation messages generated during EDI validation. These messages provide detailed information about validation errors, warnings, or confirmations based on the configured X12 validation rules such as element length constraints, code list validations, and element requirement checks. This field is populated when the
TestParsing
API validates EDI documents.Type: Array of strings
Errors
For information about the errors that are common to all actions, see Common Errors.
- AccessDeniedException
-
You do not have sufficient access to perform this action.
HTTP Status Code: 400
- InternalServerException
-
This exception is thrown when an error occurs in the AWS B2B Data Interchange service.
HTTP Status Code: 500
- ResourceNotFoundException
-
Occurs when the requested resource does not exist, or cannot be found. In some cases, the resource exists in a region other than the region specified in the API call.
HTTP Status Code: 400
- ThrottlingException
-
The request was denied due to throttling: the data speed and rendering may be limited depending on various parameters and conditions.
HTTP Status Code: 400
- ValidationException
-
When you use Transformer APIs,
TestConversion
, orTestParsing
, the service throws a validation exception if a rule is configured incorrectly. For example, a validation exception occurs when:-
A rule references an element that doesn't exist in the selected transaction set
-
An element length rule specifies a minimum length less than 0
Note
If your custom validation rules are configured correctly but the EDI validation fails due to those rules, this is expected behavior and doesn't result in a
ValidationException
.For all other API operations, a validation exception occurs when a Trading Partner object can't be validated against a request from another object. This can happen during:
-
Standard EDI validation
-
Custom validation rule evaluation, such as when:
-
Element lengths don't meet specified constraints
-
Code list validations contain invalid codes
-
Required elements are missing based on your element requirement rules
-
HTTP Status Code: 400
-
Examples
Example
The following example parses the sample input file.
Sample Request
{
"ediType": {
"x12Details": {
"transactionSet": "X12_110",
"version": "VERSION_4010"
}
},
"fileFormat": "JSON",
"inputFile": {
"bucketName": "amzn-s3-demo-bucket",
"key": "sampleFile.txt"
}
}
Sample Response
{
"parsedFileContent": "<Sample parsed file content>"
}
Example
The following example parses the sample input file with EDI splitting enabled.
Sample Request
{
"ediType": {
"x12Details": {
"transactionSet": "X12_110",
"version": "VERSION_4010"
}
},
"fileFormat": "JSON",
"inputFile": {
"bucketName": "amzn-s3-demo-bucket",
"key": "input/batch-file.edi"
},
"advancedOptions": {
"x12": {
"splitOptions": {
"splitBy": "TRANSACTION"
}
}
}
}
Sample Response
{
"parsedFileContent": ""
}
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: