Exploring Zube API with JavaScript
If you're using Zube, you might be interested in using some code to make it even better. The Zube API is open for public use, meaning that you can explore it and create your own custom integrations for your Zube account.
The API is categorized into different resources, such as Organization, Project, Epic, Issue, Milestone, and more. Each resource has its own set of endpoints that allows you to create, read, update, or delete records.
Authentication
Before you can access the Zube API, you need to authenticate yourself with your API token. You can generate a new token from your Zube account settings. The token should be passed as an HTTP header with Authorization: Token YOUR_API_TOKEN
.
Examples in JavaScript
Here are some examples of using the Zube API resources in JavaScript. You can use any HTTP client library, such as axios, fetch, or superagent.
List issues
const axios = require('axios');
axios.get('https://zube.io/api/issues/', {
headers: {
'Authorization': 'Token YOUR_API_TOKEN'
}
})
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.log(error);
});
Create an epic
const axios = require('axios');
axios.post('https://zube.io/api/epics/', {
'name': 'My Epic',
'description': 'A description of my epic'
}, {
headers: {
'Authorization': 'Token YOUR_API_TOKEN'
}
})
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.log(error);
});
Update an issue
const axios = require('axios');
axios.patch('https://zube.io/api/issues/ISSUE_ID/', {
'title': 'New title',
'description': 'New description'
}, {
headers: {
'Authorization': 'Token YOUR_API_TOKEN'
}
})
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.log(error);
});
Delete a milestone
const axios = require('axios');
axios.delete('https://zube.io/api/milestones/MILESTONE_ID/', {
headers: {
'Authorization': 'Token YOUR_API_TOKEN'
}
})
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.log(error);
});
Conclusion
Using the Zube API with JavaScript can be a powerful way to customize your workflow and automate repetitive tasks. These examples only scratch the surface of what you can do with the API, so feel free to explore more and create your own use cases. Happy hacking!