Documentation

EDIFACT Operations

Article author
Admin

With EDI API you can translate EDIFACT files to JSON (read EDIFACT), translate JSON to EDIFACT file (write EDIFACT), validate an EDIFACT transaction (validate EDIFACT), or generate EDIFACT CONTRL acknowledgments.

 

Read EDIFACT

Reads an EDIFACT file and returns its contents translated to JSON as an array of EdifactInterchange objects.

  • Path: /edifact/read
  • HTTP Verb: POST
  • Required API Key: Ocp-Apim-Subscription-Key
  • Request Content-Type: application/octet-stream or multipart/form-data
  • Request limit: 28.6 MB
  • Response Content-Type: application/json

 

Errors

  • 200: Success
  • 400: When the file stream is invalid or the form-data is not set properly.
  • 500: Something went wrong on our end. Please report at support@edination.com

The API will respond with HTTP 200 OK even if the contents of the file can't be translated. Error details will be included in the Result section of EdifactInterchange.

 

Parameters

  • ignoreNullValues boolean

    Whether to ignore all null values in the response. The default is false.

  • continueOnError boolean

    Whether to continue reading if a corrupt interchange is encountered. The default is false.

  • charSet enumeration

    The encoding of the file contents. The default is utf-8.

    The available values are:

    Value Description
    utf-16 Unicode
    unicodeFFFE Unicode (Big endian)
    utf-32 Unicode (UTF-32)
    utf-32BE Unicode (UTF-32 Big endian)
    us-ascii US-ASCII
    iso-8859-1 Western European (ISO)
    utf-7 Unicode (UTF-7)
    utf-8 Unicode (UTF-8)
  • model string

    The model to use. By default, the API will infer the model based on the transaction and version identifiers.

  • eancomS3 boolean

    The default syntax for EANCOM transactions. By default, all EANCOM transactions will be translated and validated according to the rules of Syntax 4. Set this flag to true if you need Syntax 3 to be used.

 

Write EDIFACT

Translates an EdifactInterchange object to a raw EDIFACT interchange and returns it as a stream.

  • Path: /edifact/write
  • HTTP Verb: POST
  • Required API Key: Ocp-Apim-Subscription-Key
  • Request Content-Type: application/json
  • Request limit: 28.6 MB
  • Response Content-Type: application/octet-stream

 

Errors

  • 200: Success
  • 400: When the EdifactInterchange has an invalid JSON structure.
  • 500: Something went wrong on our end. Please report at support@edination.com

 

Parameters

  • preserveWhitespace boolean

    Whether to preserve blank data elements so the output contains multiple delimiters instead of omitting any excess delimiters. The default is false.

  • charSet string

    The encoding of the resulting stream. The default is utf-8.

    The available values are:

    Value Description
    utf-16 Unicode
    unicodeFFFE Unicode (Big endian)
    utf-32 Unicode (UTF-32)
    utf-32BE Unicode (UTF-32 Big endian)
    us-ascii US-ASCII
    iso-8859-1 Western European (ISO)
    utf-7 Unicode (UTF-7)
    utf-8 Unicode (UTF-8)
  • postfix string

    The postfix to be applied at the end of each segment, just after the segment separator. This is usually a carriage return (CR), line feed (LF), or both. By default, there is no postfix.

  • sameRepetionAndDataElement boolean

    Sometimes the same delimiter is used to denote data element separator and repetition separator as in IATA transactions. By default, this is false.

  • eancomS3 boolean

    The default syntax for EANCOM transactions. By default, all EANCOM transactions will be constructed according to the rules of Syntax 4. Set this flag to true if you need Syntax 3 to be used.

 

Custom Delimiters

If you need to generate an EDIFACT with non-default separators or change the decimal notation to a comma, add a UNA object as part of the EdifactInterchange payload:

  • Segment separator: EdifactInterchange.UNA.Segment
  • Data element separator: EdifactInterchange.UNA.DataElement
  • Escape indicator: EdifactInterchange.UNA.ReleaseIndicator
  • Component data element separator: EdifactInterchange.UNA.ComponentDataElement
  • Decimal notation: EdifactInterchange.UNA.DecimalNotation

 

Validate EDIFACT

Validates an EdifactInterchange object according to the EDIFACT standard rules for each version and transaction. Returns an OperationResult object with a status field and an array of error details if any.

  • Path: /edifact/validate
  • HTTP Verb: POST
  • Required API Key: Ocp-Apim-Subscription-Key
  • Request Content-Type: application/json
  • Request limit: 28.6 MB
  • Response Content-Type: application/json

 

Errors

  • 200: Success
  • 400: When the EdifactInterchange has an invalid JSON structure.
  • 500: Something went wrong on our end. Please report at support@edination.com

 

Parameters

  • syntaxSet string

    In case you need to validate against a syntax set, different than UNOA and UNOB, populate this field with all of the allowed symbols, URL-escaped.

    All data elements with alpha (A) or alphanumeric (AN) data types are validated against a syntax set of allowed characters. The supported syntax sets are UNOA and UNOB. The validator infers the correct syntax set from EdifactInterchange.UNB.SYNTAXIDENTIFIER_1.SyntaxIdentifier_1. The symbols added to this field will override the corresponding sets in both UNOA and UNOB.

    • ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 .,-()/='+:?!\"%&*;<>
    • ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 .,-()/='+:?!\"%&*;<>abcdefghijklmnopqrstuvwxyz
  • skipTrailer boolean

    You are allowed to validate an EdifactInterchange with missing interchange, functional group, or transaction trailers (UNZ, UNE, UNT). This is because these will be automatically applied during the Write operation so you don't have to worry about counting the items. By default, it is expected that all trailers are present when you validate the EdifactInterchange and by default, this is set to false. To skip all trailer validation, set this to true.

  • structureOnly boolean

    This is equivalent to HIPAA Snip level 1, where only the structure and control segments are validated. By default, this is set to false, however, if you want to not validate things such as data types, a number of repetitions, or dates, set this to true.

  • decimalPoint string

    This could be either point "." (default) or comma ",".

  • eancomS3 boolean

    The default syntax for EANCOM transactions. By default, all EANCOM transactions will be validated according to the rules of Syntax 4. Set this flag to true if you need Syntax 3 to be used.

 

Acknowledge EDIFACT

Generates an EdifactInterchange object that contains the functional and/or technical CONTRL acknowledgment(s) for the requested EdifactInterchange. The resulting EdifactInterchange uses the UNB and UNG (optional) of the request, with the sender and receiver id/qualifier exchanged. The interchange reference number is set to 1.

  • Path: /edifact/ack
  • HTTP Verb: POST
  • Required API Key: Ocp-Apim-Subscription-Key
  • Request Content-Type: application/json
  • Request limit: 28.6 MB
  • Response Content-Type: application/json

 

Errors

  • 200: Success
  • 400: When the EdifactInterchange has an invalid JSON structure.
  • 500: Something went wrong on our end. Please report at support@edination.com

 

Parameters

  • syntaxSet string

    In case you need to validate against a syntax set, different than UNOA and UNOB, populate this field with all of the allowed symbols, URL-escaped.

    All data elements with alpha (A) or alphanumeric (AN) data types are validated against a syntax set of allowed characters. The supported syntax sets are UNOA and UNOB. The validator infers the correct syntax set from EdifactInterchange.UNB.SYNTAXIDENTIFIER_1.SyntaxIdentifier_1. The symbols added to this field will override the corresponding sets in both UNOA and UNOB.

    • ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 .,-()/='+:?!\"%&*;<>
    • ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 .,-()/='+:?!\"%&*;<>abcdefghijklmnopqrstuvwxyz
  • detectDuplicates boolean

    If you need to detect duplicates as in functional groups or transactions with the same reference number, set this flag to true. The default is false.

  • tranRefNumber integer

    The default is 1. Set this to whatever the CONTRL UNH.MessageReferenceNumber_01 needs to be.

  • interchangeRefNumber integer

    The default is 1. Set this to whatever the CONTRL EdifactInterchange.UNB.InterchangeControlReference_5 needs to be.

  • ackForValidTrans boolean

    The default is false. Set this to true if you need UCM loops included for all valid transactions as well. By default, UCM loops are generated only for invalid transactions.

  • batchAcks boolean

    The default is true. Set this to false if you need to generate separate EdifactInterchange for each acknowledgment. By default, all acknowledgments are batched in the same EdifactInterchange.

  • technicalAck enumeration

    The default technical acknowledgment CONTRL is generated according to EdifactInterchange.UNB.AcknowledgementRequest_9. You can either enforce it to always generate technical CONTRLs or suppress it to never generate any technical CONTRLs. This will override the flag in EdifactInterchange.UNB.AcknowledgementRequest_9.

    The available values are:

    Value Description
    enforce Always generate technical CONTRL
    suppress Never generate technical CONTRL
    default Generate technical CONTRL according to AcknowledgementRequest_9
  • eancomS3 boolean

    The default syntax for EANCOM transactions. By default, all EANCOM transactions will be validated according to the rules of Syntax 4. Set this flag to true if you need Syntax 3 to be used.

 

API Tutorials

To learn more about how to translate and validate EDI files with EDI API try these tutorials:

Share this:

Was this article helpful?

Comments

1 comment

  • Comment author
    Ravinder Singh Dhillon

    Query on the difference between Read and Validate - does a Read include validation as part of the translation to JSON?

    0

Please sign in to leave a comment.