portainer-api-wrapper
v0.0.2
Published
NodeJS Portainer API wrapper
Downloads
123
Maintainers
Readme
NodeJS Portainer API Wrapper
- This is a simple wrapper for the Portainer API. It is written in NodeJS and uses the axios module.
- For more information about the Portainer API, please visit the Portainer API Documentation
- Still WIP
Installation
npm install portainer-api-wrapper
Documentation
Click here for NodeJS Portainer API Wrapper docs
Contributing
This project is still in development and we are looking for contributors. If you want to contribute, you can find the source code here. Please open a pull request with your changes. There are no guidelines yet, but please try to follow the existing code style.
Usage
⚠️ Still in development, everything will change! ⚠️
import {
PortainerAPIWrapper,
EPortainerCustomTemplateType,
} from "portainer-api-wrapper";
const portainer = new PortainerAPIWrapper({
host: "localhost:9443",
username: "admin",
password: "admin",
secure: false,
saveToken: true,
});
async function main() {
await portainer.auth.authenticate();
const customTemplates = await portainer.customTemplates.getAll(
EPortainerCustomTemplateType.SWARM,
);
console.log(customTemplates); // https://app.swaggerhub.com/apis/portainer/portainer-ee/2.18.4#/custom_templates/CustomTemplateList
// ⚠️ API WILL CHANGE ⚠️
// We are currently making simple http requests to the portainer api but we will change this to a more object oriented approach
const res = await portainer.api.get("stacks");
console.log(res.data); // https://app.swaggerhub.com/apis/portainer/portainer-ee/2.18.4#/stacks/StackList
}
main();