Skip to main content

Using Apito REST API with Javascript Project

note

Always remember to replace API_SECRET of the Bearer Token and project-id of the URL with the correct value from apito console. Go to this page if you do not know where to find your api secrets and endpoints for your project

Using Axios#

const token = 'apito-api-secret';
axios.get('https://api.apito.io/secured/rest/project', {
headers: {
'Authorization': `Bearer ${token}`
}
})
.then((res) => {
console.log(res.data)
})
.catch((error) => {
console.error(error)
})

Using Fetch#

const token = 'apito-api-secret';
fetch('https://api.apito.io/secured/rest/project', {
headers: {
Authorization: `Bearer ${token}`
}
}).then(res => res.json())
.then(json => console.log(json));