test_parsing
¶
test_parsing(
input_file: S3Location,
file_format: FileFormat,
edi_type: EdiType,
*,
config_overrides: Optional[b2biClientConfig] = None,
advanced_options: Optional[AdvancedOptions] = None,
) -> TestParsingResponse
Parses the input EDI (electronic data interchange) file. The input file has a file size limit of 250 KB.
Parameters:
-
input_file(S3Location) –Specifies an
S3Locationobject, which contains the Amazon S3 bucket and prefix for the location of the input file. -
file_format(FileFormat) –Specifies that the currently supported file formats for EDI transformations are
JSONandXML. -
edi_type(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.
-
advanced_options(Optional[AdvancedOptions], default:None) –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.
Raises:
-
AccessDeniedException–You do not have sufficient access to perform this action.
-
InternalServerException–This exception is thrown when an error occurs in the Amazon Web Services B2B Data Interchange service.
-
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.
-
ThrottlingException–The request was denied due to throttling: the data speed and rendering may be limited depending on various parameters and conditions.
-
ValidationException–Occurs when a B2BI object cannot be validated against a request from another object. This exception can be thrown during standard EDI validation or when custom validation rules fail, such as when element length constraints are violated, invalid codes are used in code list validations, or required elements are missing based on configured element requirement rules.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Sample TestParsing call
>>> client.test_parsing(edi_type={'x12Details': {'transactionSet': 'X12_110', 'version': 'VERSION_4010'}}, file_format='JSON', input_file={'bucketName': 'test-bucket', 'key': 'sampleFile.txt'})
Sample TestParsing call without EDI Splitting
>>> client.test_parsing(edi_type={'x12Details': {'transactionSet': 'X12_110', 'version': 'VERSION_4010'}}, file_format='JSON', advanced_options={'x12': {'splitOptions': {'splitBy': 'NONE'}}}, input_file={'bucketName': 'test-bucket', 'key': 'sampleFile.txt'})
Sample TestParsing call with EDI Splitting by Transaction
>>> client.test_parsing(edi_type={'x12Details': {'transactionSet': 'X12_110', 'version': 'VERSION_4010'}}, file_format='JSON', advanced_options={'x12': {'splitOptions': {'splitBy': 'TRANSACTION'}}}, input_file={'bucketName': 'test-bucket', 'key': 'sampleFile.txt'})
Sample TestParsing call with Validation Options
>>> client.test_parsing(edi_type={'x12Details': {'transactionSet': 'X12_110', 'version': 'VERSION_4010'}}, file_format='JSON', advanced_options={'x12': {'validationOptions': {'validationRules': [{'codeListValidationRule': {'elementId': '1280', 'codesToAdd': ['X', 'Y', 'Z'], 'codesToRemove': ['A', 'B', 'C']}}, {'elementRequirementValidationRule': {'elementPosition': 'NM1-01', 'requirement': 'OPTIONAL'}}, {'elementLengthValidationRule': {'elementId': '0803', 'maxLength': 30, 'minLength': 5}}]}}}, input_file={'bucketName': 'test-bucket', 'key': 'sampleFile.txt'})