# Code examples
# JavaScript
The below examples use the axios (opens new window) library to make HTTP requests.
# Obtain a token wih username and password
axios.post(
"https://api.gestal.cloud/auth",
{},
{
auth: {
username: "VALID_EMAIL",
password: "VALID_PASSWORD"
}
}
)
.then(response => { //response contains a token
console.log(response);
})
.catch(error => {
console.log(error.response);
});
# Retrieve integrations using bearer token
axios.get("https://api.gestal.cloud/integrator", {
Authorization: {
Bearer: "VALID_TOKEN"
}
})
.then(response => { //response contains a list of integration JSON objects
console.log(response);
})
.catch(error => {
console.log(error.response);
});
# Retrieve Sows using an access key
axios.get("https://api.gestal.cloud/integration/sows", {
auth: {
username: "VALID_ACCESS_KEY"
}
})
.then(response => { //response contains a list of sows
console.log(response);
})
.catch(error => {
console.log(error.response);
});
# Send a sow mirror using an access key
axios.post("https://api.gestal.cloud/integration/sow-mirrors", {
"VALID_KEY": "VALID_VALUE"
}, {
auth: {
username: "VALID_ACCESS_KEY"
}
})
.then(response => { //response contains the created sow-mirror
console.log(response);
})
.catch(error => {
console.log(error.response);
});
# Java
A sample Java project is available on our GitHub (opens new window) to get you started.