Quickstart - Rebuild

This page can be used as a guide to getting started using the Rebuild API. It describes getting the product key and executing a request to the API.

Just want to call the API?

Run in Postman

Get Key

A key is required to access the Glasswlal Rebuild API, one can be purchased here

Http Code - Rebuild File

In the following examples choose a language to get started with using the endpoints programmatically.

A known good file for executing the request can be downloaded here

Code Examples

// This Javascript snippet makes use of the request library
// Get it with npm: "npm install request" or read the docs:
// https://www.npmjs.com/package/request
const request = require("request");
const fs = require("fs");
const apiKey = "YOUR_API_KEY";
const url = "https://lknt3bidbf.execute-api.eu-west-1.amazonaws.com/Prod/api/rebuild/file";
const inputFilePath = "YOUR/INPUT/FILE.docx";
const outputFilePath = "YOUR/INPUT/FILE.docx"
const options = {
"encoding": null,
"method": "POST",
"url": url,
"headers": {
"x-api-key": apiKey,
'Accept': 'application/octet-stream'
},
formData: {
"file": {
"value": fs.createReadStream(inputFilePath),
"options": {
"filename": "/" + inputFilePath,
"contentType": null
}
}
}
}
// Send a file to Glasswall's Rebuild API
// callback passed to request library
request(options, function (error, res) {
if (error) throw new Error(error);
if (!(res.statusCode == 200 && res.body)) return;
// Glasswall has now sanitised and returned this file
let data = res.body
let buf = Buffer.from(data);
// Write the sanitised file to the output file path
let file = fs.createWriteStream(outputFilePath);
file.write(buf);
file.end();
});

In the next documents, there will be information surrounding how the API works, how to configure requests and alternative endpoints to use.