UsersApi.md 12 KB

PortainerApi.UsersApi

All URIs are relative to http://portainer.domain/api

Method HTTP request Description
userAdminCheck GET /users/admin/check Check administrator account existence
userAdminInit POST /users/admin/init Initialize administrator account
userCreate POST /users Create a new user
userDelete DELETE /users/{id} Remove a user
userInspect GET /users/{id} Inspect a user
userList GET /users List users
userMembershipsInspect GET /users/{id}/memberships Inspect a user memberships
userPasswordCheck POST /users/{id}/passwd Check password validity for a user
userUpdate PUT /users/{id} Update a user

userAdminCheck

userAdminCheck()

Check administrator account existence

Check if an administrator account exists in the database. Access policy: public

Example

var PortainerApi = require('portainer_api');
var defaultClient = PortainerApi.ApiClient.instance;

// Configure API key authorization: jwt
var jwt = defaultClient.authentications['jwt'];
jwt.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//jwt.apiKeyPrefix = 'Token';

var apiInstance = new PortainerApi.UsersApi();

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.userAdminCheck(callback);

Parameters

This endpoint does not need any parameter.

Return type

null (empty response body)

Authorization

jwt

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

userAdminInit

User userAdminInit(body)

Initialize administrator account

Initialize the 'admin' user account. Access policy: public

Example

var PortainerApi = require('portainer_api');
var defaultClient = PortainerApi.ApiClient.instance;

// Configure API key authorization: jwt
var jwt = defaultClient.authentications['jwt'];
jwt.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//jwt.apiKeyPrefix = 'Token';

var apiInstance = new PortainerApi.UsersApi();

var body = new PortainerApi.UserAdminInitRequest(); // UserAdminInitRequest | User details


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.userAdminInit(body, callback);

Parameters

Name Type Description Notes
body UserAdminInitRequest User details

Return type

User

Authorization

jwt

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

userCreate

UserSubset userCreate(body)

Create a new user

Create a new Portainer user. Only team leaders and administrators can create users. Only administrators can create an administrator user account. Access policy: restricted

Example

var PortainerApi = require('portainer_api');
var defaultClient = PortainerApi.ApiClient.instance;

// Configure API key authorization: jwt
var jwt = defaultClient.authentications['jwt'];
jwt.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//jwt.apiKeyPrefix = 'Token';

var apiInstance = new PortainerApi.UsersApi();

var body = new PortainerApi.UserCreateRequest(); // UserCreateRequest | User details


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.userCreate(body, callback);

Parameters

Name Type Description Notes
body UserCreateRequest User details

Return type

UserSubset

Authorization

jwt

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

userDelete

userDelete(id)

Remove a user

Remove a user. Access policy: administrator

Example

var PortainerApi = require('portainer_api');
var defaultClient = PortainerApi.ApiClient.instance;

// Configure API key authorization: jwt
var jwt = defaultClient.authentications['jwt'];
jwt.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//jwt.apiKeyPrefix = 'Token';

var apiInstance = new PortainerApi.UsersApi();

var id = 56; // Number | User identifier


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.userDelete(id, callback);

Parameters

Name Type Description Notes
id Number User identifier

Return type

null (empty response body)

Authorization

jwt

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

userInspect

User userInspect(id)

Inspect a user

Retrieve details about a user. Access policy: administrator

Example

var PortainerApi = require('portainer_api');
var defaultClient = PortainerApi.ApiClient.instance;

// Configure API key authorization: jwt
var jwt = defaultClient.authentications['jwt'];
jwt.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//jwt.apiKeyPrefix = 'Token';

var apiInstance = new PortainerApi.UsersApi();

var id = 56; // Number | User identifier


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.userInspect(id, callback);

Parameters

Name Type Description Notes
id Number User identifier

Return type

User

Authorization

jwt

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

userList

UserListResponse userList()

List users

List Portainer users. Non-administrator users will only be able to list other non-administrator user accounts. Access policy: restricted

Example

var PortainerApi = require('portainer_api');
var defaultClient = PortainerApi.ApiClient.instance;

// Configure API key authorization: jwt
var jwt = defaultClient.authentications['jwt'];
jwt.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//jwt.apiKeyPrefix = 'Token';

var apiInstance = new PortainerApi.UsersApi();

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.userList(callback);

Parameters

This endpoint does not need any parameter.

Return type

UserListResponse

Authorization

jwt

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

userMembershipsInspect

UserMembershipsResponse userMembershipsInspect(id)

Inspect a user memberships

Inspect a user memberships. Access policy: authenticated

Example

var PortainerApi = require('portainer_api');
var defaultClient = PortainerApi.ApiClient.instance;

// Configure API key authorization: jwt
var jwt = defaultClient.authentications['jwt'];
jwt.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//jwt.apiKeyPrefix = 'Token';

var apiInstance = new PortainerApi.UsersApi();

var id = 56; // Number | User identifier


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.userMembershipsInspect(id, callback);

Parameters

Name Type Description Notes
id Number User identifier

Return type

UserMembershipsResponse

Authorization

jwt

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

userPasswordCheck

UserPasswordCheckResponse userPasswordCheck(id, body)

Check password validity for a user

Check if the submitted password is valid for the specified user. Access policy: authenticated

Example

var PortainerApi = require('portainer_api');
var defaultClient = PortainerApi.ApiClient.instance;

// Configure API key authorization: jwt
var jwt = defaultClient.authentications['jwt'];
jwt.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//jwt.apiKeyPrefix = 'Token';

var apiInstance = new PortainerApi.UsersApi();

var id = 56; // Number | User identifier

var body = new PortainerApi.UserPasswordCheckRequest(); // UserPasswordCheckRequest | User details


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.userPasswordCheck(id, body, callback);

Parameters

Name Type Description Notes
id Number User identifier
body UserPasswordCheckRequest User details

Return type

UserPasswordCheckResponse

Authorization

jwt

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

userUpdate

User userUpdate(id, body)

Update a user

Update user details. A regular user account can only update his details. Access policy: authenticated

Example

var PortainerApi = require('portainer_api');
var defaultClient = PortainerApi.ApiClient.instance;

// Configure API key authorization: jwt
var jwt = defaultClient.authentications['jwt'];
jwt.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//jwt.apiKeyPrefix = 'Token';

var apiInstance = new PortainerApi.UsersApi();

var id = 56; // Number | User identifier

var body = new PortainerApi.UserUpdateRequest(); // UserUpdateRequest | User details


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.userUpdate(id, body, callback);

Parameters

Name Type Description Notes
id Number User identifier
body UserUpdateRequest User details

Return type

User

Authorization

jwt

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json