Skip to content

Files

Latest commit

9952829 · Apr 8, 2021

History

History
265 lines (187 loc) · 9.26 KB

UserManagementApi.md

File metadata and controls

265 lines (187 loc) · 9.26 KB

Onepanel.UserManagementApi

All URIs are relative to https://localhost/api/v3/onepanel

Method HTTP request Description
addOnezoneUser POST /zone/users Create Onezone user
changeUserPassword PATCH /zone/users/{id} Set password for Onezone user
getOnezoneUser GET /zone/users/{id} Get Onezone user details
getOnezoneUsers GET /zone/users List Onezone users

addOnezoneUser

Id addOnezoneUser(userCreateRequest)

Create Onezone user

Creates a new Onezone user account with Basic (username & password) authentication enabled. Example cURL requests Create Onezone user with username & password ```bash curl -H "X-Auth-Token: $TOKEN" -X POST https://$OZ_PANEL_HOST/api/v3/onepanel/zone/users \ -H "Content-Type: application/json" -d '{ "username": "someUser", "password": "somePassword" }' { "id": "b519b3ac46823b2b83b6cb85e1b16f4fchaa0f" } ```

Example

var Onepanel = require('onepanel');
var defaultClient = Onepanel.ApiClient.instance;

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

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

// Configure HTTP basic authorization: basic
var basic = defaultClient.authentications['basic'];
basic.username = 'YOUR USERNAME';
basic.password = 'YOUR PASSWORD';

var apiInstance = new Onepanel.UserManagementApi();

var userCreateRequest = new Onepanel.OnezoneUserCreateRequest(); // OnezoneUserCreateRequest | The user configuration details.


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

Parameters

Name Type Description Notes
userCreateRequest OnezoneUserCreateRequest The user configuration details.

Return type

Id

Authorization

api_key1, api_key2, basic

HTTP request headers

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

changeUserPassword

changeUserPassword(id, passwordChangeRequest)

Set password for Onezone user

Sets a new password for a Onezone user using Basic authentication. Example cURL requests Set Onezone user password ```bash curl -H "X-Auth-Token: $TOKEN" -X PATCH https://$OZ_PANEL_HOST/api/v3/onepanel/zone/users/$USER_ID \ -H "Content-Type: application/json" -d '{"newPassword": "someNewPassword"}' ```

Example

var Onepanel = require('onepanel');
var defaultClient = Onepanel.ApiClient.instance;

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

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

// Configure HTTP basic authorization: basic
var basic = defaultClient.authentications['basic'];
basic.username = 'YOUR USERNAME';
basic.password = 'YOUR PASSWORD';

var apiInstance = new Onepanel.UserManagementApi();

var id = "id_example"; // String | Id of the user whose password is changed.

var passwordChangeRequest = new Onepanel.PasswordChangeRequest(); // PasswordChangeRequest | 


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

Parameters

Name Type Description Notes
id String Id of the user whose password is changed.
passwordChangeRequest PasswordChangeRequest

Return type

null (empty response body)

Authorization

api_key1, api_key2, basic

HTTP request headers

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

getOnezoneUser

OnezoneUser getOnezoneUser(id)

Get Onezone user details

Returns the configuration information of the Onezone user. Example cURL requests Get Onezone user details ```bash curl -H "X-Auth-Token: $TOKEN" -X GET https://$OZ_PANEL_HOST/api/v3/onepanel/zone/users/$USER_ID { "username": "someUser", "userId": "b519b3ac46823b2b83b6cb85e1b16f4fchaa0f", "fullName": "Unnamed User" } ```

Example

var Onepanel = require('onepanel');
var defaultClient = Onepanel.ApiClient.instance;

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

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

// Configure HTTP basic authorization: basic
var basic = defaultClient.authentications['basic'];
basic.username = 'YOUR USERNAME';
basic.password = 'YOUR PASSWORD';

var apiInstance = new Onepanel.UserManagementApi();

var id = "id_example"; // String | Id of the user to be described.


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

Parameters

Name Type Description Notes
id String Id of the user to be described.

Return type

OnezoneUser

Authorization

api_key1, api_key2, basic

HTTP request headers

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

getOnezoneUsers

Ids getOnezoneUsers()

List Onezone users

List Ids of Onezone users. Example cURL requests Get Onezone user ids ```bash curl -H "X-Auth-Token: $TOKEN" -X GET https://$OZ_PANEL_HOST/api/v3/onepanel/zone/users { "ids": [ "f891d1ddf693232bbf0c11fe3cd9f7e7cheda9", "eefc8a11e1776d0797969ccf0b59c6dcch73dc", "ec0a39261b325cdc74e9c2d6b54fa786ch0419" ] } ```

Example

var Onepanel = require('onepanel');
var defaultClient = Onepanel.ApiClient.instance;

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

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

// Configure HTTP basic authorization: basic
var basic = defaultClient.authentications['basic'];
basic.username = 'YOUR USERNAME';
basic.password = 'YOUR PASSWORD';

var apiInstance = new Onepanel.UserManagementApi();

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

Parameters

This endpoint does not need any parameter.

Return type

Ids

Authorization

api_key1, api_key2, basic

HTTP request headers

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