NAV Navbar
cURL Node.js Python PHP Java Ruby

Compression API v2019-11-19T10:21:23Z

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

The Compression API is used to compress and decompress data. The Compression API is part of the Compression service from Melrose Labs.

Base URLs:

Email: Melrose Labs - Technical Support

Authentication

Compress

Compress data

Code samples

# You can also use wget
curl -X POST https://api.melroselabs.com/compression/compressor \
  -H 'Content-Type: application/octet-stream' \
  -H 'Accept: application/octet-stream' \
  -H 'x-api-key: API_KEY'

const fetch = require('node-fetch');
const inputBody = '{}';
const headers = {
  'Content-Type':'application/octet-stream',
  'Accept':'application/octet-stream',
  'x-api-key':'API_KEY'

};

fetch('https://api.melroselabs.com/compression/compressor',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

import requests
headers = {
  'Content-Type': 'application/octet-stream',
  'Accept': 'application/octet-stream',
  'x-api-key': 'API_KEY'
}

r = requests.post('https://api.melroselabs.com/compression/compressor', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/octet-stream',
    'Accept' => 'application/octet-stream',
    'x-api-key' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.melroselabs.com/compression/compressor', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.melroselabs.com/compression/compressor");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/octet-stream',
  'Accept' => 'application/octet-stream',
  'x-api-key' => 'API_KEY'
}

result = RestClient.post 'https://api.melroselabs.com/compression/compressor',
  params: {
  }, headers: headers

p JSON.parse(result)

POST /compressor

Compress data stream using selected or default compression algorithm.

Body parameter

{}

Parameters

Name In Type Required Description
body body Empty true Data stream to be compressed

Example responses

200 Response

{}

Responses

Status Meaning Description Schema
200 OK 200 response Empty

Schemas

Empty

{}

Empty Schema

Properties

None