portainer-api-wrapper
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

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();

Package Sidebar

Install

npm i portainer-api-wrapper

Weekly Downloads

4

Version

0.0.2

License

MIT

Unpacked Size

39 kB

Total Files

21

Last publish

Collaborators

  • leydihavuc