JavaScript

Get data

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("x-api-key", "<you api key>");
myHeaders.append("user", "demo@sample.com");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.getdatapipe.com/v1/data/<your account ID>/<your endpoint ID>", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Transform a file

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
myHeaders.append("x-api-key", "<your api key>");
myHeaders.append("user", "demo@sample.com");
var formdata = new FormData();
formdata.append("file", fileInput.files[0], "demo.csv");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: formdata,
redirect: 'follow'
};
fetch("https://api.getdatapipe.com/v1/data/<your account ID>/<your endpoint ID>/file", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Transform a Google Sheet

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
myHeaders.append("x-api-key", "<your api key>");
myHeaders.append("user", "demo@sample.com");
var urlencoded = new URLSearchParams();
urlencoded.append("spreadhsheetId", "Google Spread Sheet ID");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: urlencoded,
redirect: 'follow'
};
fetch("https://api.getdatapipe.com/v1/data/<your account ID>/<your endpoint ID>/sheet", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));