npm install portainer-api-wrapper
Click here for NodeJS Portainer API Wrapper docs
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.
⚠️ 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();
Generated using TypeDoc