Home /  Legacy products /  EDI Core / 
This is a legacy product

Sending compressed payloads

To send a gzip compressed payload to the EDI Core API, set the Content-Type header to the value of application/gzip. EDI Core only supports gzip compression.
Note that the maximum document size limit is applied after decompressing the content of the payload. If the decompressed payload of a given request is larger than the maximum document size limit, the EDI Core API will reject the request.
The following TypeScript example shows how to send a gzip compressed payload to the /translate endpoint.
import * as fs from "fs";
import axios from "axios";
import { gzipSync } from "zlib";

const API_KEY = "YOUR_API_KEY";
const rootURL = "https://edi-core.stedi.com/2021-06-05/translate";
const headers = {
  "Authorization": `Key ${API_KEY}`,
  "content-type": "application/gzip",
  "accept-encoding": "gzip",
};
const edi = fs.readFileSync(process.argv[2], "utf-8");

async function makeRequest(): Promise<void> {
  const request = {
    input: edi,
    input_format: "edi",
    output_format: "jedi@2.0",
  };

  const response = await axios.request({
    method: "post",
    url: url,
    data: gzipSync(JSON.stringify(request)),
    headers: headers,
  });
  console.log(response.status);
  console.log(response.data);
}

async function main() {
  try {
    await makeRequest();
  } catch (e) {
    console.log(e);
  }
}

main();

Feedback

Have an idea for something we could improve? Page not clear? We love feedback - send us a message.

Stedi

Build EDI integrations fast, without being an EDI expert

Start building
About
ProductPricingCareersContactBlog
Follow
  1. Twitter
  2. GitHub
Backed by
AdditionBloomberg BetaFirst RoundStripeUSV
Customer AgreementService TermsPrivacy Notice

Stedi is a registered trademark of Stedi, Inc. All names, logos, and brands of third parties listed on our site are trademarks of their respective owners (including “X12”, which is a trademark of X12 Incorporated). Stedi, Inc. and its products and services are not endorsed by, sponsored by, or affiliated with these third parties. Our use of these names, logos, and brands is for identification purposes only, and does not imply any such endorsement, sponsorship, or affiliation.