opsi-api / Exports / api / OPSIApi

# Class: OPSIApi

api.OPSIApi

Class OPSIApi

# Implements

# Table of contents

# Constructors

# Properties

# Methods

# Constructors

# constructor

new OPSIApi(apiURL, username, password, id?)

Create/Initiate OPSIApi.

# Parameters

Name Type Default value Description
apiURL string undefined OPSI Api URL String Example: Https://opsiserver:4447.
username string undefined OPSI user with access rights.
password string undefined Password of the api user.
id number 1 OPSI Api Server ID. Default is 1

# Defined in

api.ts:130 (opens new window)

# Properties

# addClientToGroup

addClientToGroup: (clientId: string, groupId: string) => Promise<IfcResult> = Group.prototype.addClientToGroup

# Type declaration

▸ (clientId, groupId): Promise<IfcResult>

add client to group

example

//returns boolean only on super bad data it will return an error message
const { success, data, message } = await api.addClientToGroup('grouptestclient.opsi.lan', 'group01')
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // returns true, false or an error object on fail
# Parameters
Name Type Description
clientId string Client ID
groupId string Group ID
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Group.addClientToGroup

# Defined in

api.ts:100 (opens new window)


# apiURL

apiURL: string

# Defined in

api.ts:12 (opens new window)


# callActionForProductOnClient

callActionForProductOnClient: (clientId: string, productId: string, action: string) => Promise<IfcResult> = Client.prototype.callActionForProductOnClient

# Type declaration

▸ (clientId, productId, action): Promise<IfcResult>

set an action request for the given product and the given client.

# Parameters
Name Type
clientId string
productId string
action string
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.callActionForProductOnClient

# Defined in

api.ts:70 (opens new window)


# createClient

createClient: (clientName: string, domain: string, description: string, notes: string, ipAddress: string, hardwareAddress: string) => Promise<IfcResult> = Client.prototype.createClient

# Type declaration

▸ (clientName, domain, description?, notes?, ipAddress?, hardwareAddress?): Promise<IfcResult>

create client.

example

//returns client id name in data
const { success, data, message } = await api.createClient('client01', 'opsi.lan', 'Description', 'Client notes', '192.168.0.1', 'xx:xx:xx:xx:xx:01')
console.log(data) // returns client01.opsi.lan or an error object on fail
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
# Parameters
Name Type Default value Description
clientName string undefined Client Name
domain string undefined Client domain
description string '' description of the client
notes string '' Notes for this client
ipAddress string '' Client IP Address
hardwareAddress string '' physical address of the client
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.createClient

# Defined in

api.ts:26 (opens new window)


# createHostGroup

createHostGroup: (groupName: string, members: string, description: string, parentGroupId: string) => Promise<IfcResult> = Group.prototype.createHostGroup

# Type declaration

▸ (groupName, members, description?, parentGroupId?): Promise<IfcResult>

create group

example

//returns boolean only on super bad data it will return an error message
const { success, data, message } = await api.createHostGroup(
                   'group01',
                   '',
                   'Group description',
                   '')
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // data returns also true or an error object on fail
# Parameters
Name Type Default value Description
groupName string undefined Group ID Name
members string undefined Members Object? String? Array?
description string '' Group description string
parentGroupId string '' Parent Group ID Name
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Group.createHostGroup

# Defined in

api.ts:92 (opens new window)


# deleteClient

deleteClient: (clientId: string) => Promise<IfcResult> = Client.prototype.deleteClient

# Type declaration

▸ (clientId): Promise<IfcResult>

delete one client by id.

example

//returns boolean only on super bad data it will return an error message
const { success, data, message } = await api.delete(clientId)
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // data returns null on success or an error object on fail
# Parameters
Name Type Description
clientId string Client ID
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.deleteClient

# Defined in

api.ts:46 (opens new window)


# deleteGroup

deleteGroup: (groupId: string) => Promise<IfcResult> = Group.prototype.deleteGroup

# Type declaration

▸ (groupId): Promise<IfcResult>

delete group if group id string is an empty string all groups would be deleted WARNING!!!

example

//returns boolean only on super bad data it will return an error message
const { success, data, message } = await api.deleteGroup('group01')
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // returns also boolean or an error object on fail
# Parameters
Name Type Description
groupId string Group ID
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Group.deleteGroup

# Defined in

api.ts:108 (opens new window)


# fireEventForClient

fireEventForClient: (clientId: string, event: string) => Promise<IfcResult> = Client.prototype.fireEventForClient

# Type declaration

▸ (clientId, event): Promise<IfcResult>

fire event for clients for example on_demand

example

//returns boolean only on super bad data it will return an error message
const { success, data, message } = await api.fireEventForClient(clientId, 'on_demand')
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // data returns null on success or an error object on fail
# Parameters
Name Type
clientId string
event string
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.fireEventForClient

# Defined in

api.ts:60 (opens new window)


# getAllActionsForProduct

getAllActionsForProduct: (productid: string, serverid: number) => Promise<IfcResult> = Product.prototype.getAllActionsForProduct

# Type declaration

▸ (productid, serverid): Promise<IfcResult>

Get all actions for one product.

example

const server = await api.getServerIDs();
const { success, data, message } = await api.getAllActionsForProduct('swaudit', server.data[0]);
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // array of product actions

api.serverIDs() api.actionsForProduct('', servers[0])

# Parameters
Name Type Description
productid string Any id string.
serverid number Serverid string that gets from serverIDs.
# Returns

Promise<IfcResult>

Data.

# Implementation of

Product.getAllActionsForProduct

# Defined in

api.ts:114 (opens new window)


# getAllClients

getAllClients: () => Promise<IfcResult> = Client.prototype.getAllClients

# Type declaration

▸ (): Promise<IfcResult>

Get all clients.

example

//returns array of all clients
const { success, data, message } = await api.getAllClients()
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // returns array of client objects or an error object on fail
[ { ident: 'client01.opsi.lan',
    description: 'Description',
    created: '2019-02-18 18:50:33',
    inventoryNumber: '',
    ipAddress: null,
    notes: '',
    oneTimePassword: null,
    lastSeen: '2019-02-18 18:50:33',
    hardwareAddress: null,
    opsiHostKey: '8b3ffde7170a25d48104141786ad9ba2',
    type: 'OpsiClient',
    id: 'client01.opsi.lan' } ]
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.getAllClients

# Defined in

api.ts:24 (opens new window)


# getAllHostGroups

getAllHostGroups: () => Promise<IfcResult> = Group.prototype.getAllHostGroups

# Type declaration

▸ (): Promise<IfcResult>

Get all groups.

example

//returns an array of opsi groups
const { success, data, message } = await api.getAllGroups()
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // returns array of group infos or an error object on fail
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Group.getAllHostGroups

# Defined in

api.ts:88 (opens new window)


# getAllHostGroupsWithClients

getAllHostGroupsWithClients: () => Promise<IfcResult> = Group.prototype.getAllHostGroupsWithClients

# Type declaration

▸ (): Promise<IfcResult>

Get all groups with clients.

example

//returns an array of opsi groups
const { success, data, message } = await api.getAllHostGroupsWithClients()
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // returns array of group infos or an error object on fail
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Group.getAllHostGroupsWithClients

# Defined in

api.ts:90 (opens new window)


# getAllProducts

getAllProducts: () => Promise<IfcResult> = Product.prototype.getAllProducts

# Type declaration

▸ (): Promise<IfcResult>

Get all installed products from opsi depot.

example

const { success, data, message } = await api.getAllProducts()
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // array of opsi products
# Returns

Promise<IfcResult>

Data.

# Implementation of

Product.getAllProducts

# Defined in

api.ts:112 (opens new window)


# getClientDetails

getClientDetails: (clientId: string) => Promise<IfcResult> = Client.prototype.getClientDetails

# Type declaration

▸ (clientId): Promise<IfcResult>

get full client details

example

const { success, data, message } = await api.getClientDetails('client01.opsi.lan')
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // data returns a huge object with relevant client data
// object structure
{
  groups: [],
  hardware: {},
  info: {},
  products: {}
};
# Parameters
Name Type
clientId string
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.getClientDetails

# Defined in

api.ts:42 (opens new window)


# getClientGroups

getClientGroups: (clientId: string) => Promise<IfcResult> = Client.prototype.getClientGroups

# Type declaration

▸ (clientId): Promise<IfcResult>

get all groups for one client. if client not exists it will return also true and an empty array

example

const { success, data, message } = await api.getClientGroups('client01.opsi.lan')
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // data returns a array of groups or an empty array
# Parameters
Name Type
clientId string
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.getClientGroups

# Defined in

api.ts:32 (opens new window)


# getClientHardware

getClientHardware: (clientId: string) => Promise<IfcResult> = Client.prototype.getClientHardware

# Type declaration

▸ (clientId): Promise<IfcResult>

if hwaudit is successfully ran on this client you will get a huge object of hardware information

example

const { success, data, message } = await api.getClientHardware('client01.opsi.lan')
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // data returns a object of hardware information or an empty object
# Parameters
Name Type
clientId string
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.getClientHardware

# Defined in

api.ts:34 (opens new window)


# getClientInfo

getClientInfo: (clientId: string) => Promise<IfcResult> = Client.prototype.getClientInfo

# Type declaration

▸ (clientId): Promise<IfcResult>

get client info

example

//returns object with client info
const { success, data, message } = await api.getClientInfo('client01.opsi.lan',)
console.log(data) // returns
{ ident: 'client01.opsi.lan',
 description: 'Description',
 created: '2019-02-19 18:11:10',
  inventoryNumber: '',
  ipAddress: null,
  notes: '',
  oneTimePassword: null,
  lastSeen: '2019-02-19 18:11:10',
  hardwareAddress: null,
  opsiHostKey: 'c748d0b0d2015dfda0306dc0a862a612',
  type: 'OpsiClient',
  id: 'client01.opsi.lan' }
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
# Parameters
Name Type Description
clientId string Client ID Name
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.getClientInfo

# Defined in

api.ts:30 (opens new window)


# getClientLogs

getClientLogs: (clientId: string, logType: string, length: number) => Promise<IfcResult> = Client.prototype.getClientLogs

# Type declaration

▸ (clientId, logType, length?): Promise<IfcResult>

get logs for client. some possible log data instlog (opsi-winst), clientconnect (opsiclientd), userlogin, bootimage and opsiconfd

# Parameters
Name Type Default value Description
clientId string undefined
logType string undefined
length number 'instlog' number of characters to show
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.getClientLogs

# Defined in

api.ts:52 (opens new window)


# getClientObjectConfig

getClientObjectConfig: (clientId: string, configId: string) => Promise<IfcResult> = Client.prototype.getClientObjectConfig

# Type declaration

▸ (clientId, configId): Promise<IfcResult>

get client config object

# Parameters
Name Type
clientId string
configId string
# Returns

Promise<IfcResult>

# Implementation of

Client.getClientObjectConfig

# Defined in

api.ts:82 (opens new window)


# getClientObjectConfigs

getClientObjectConfigs: (clientId: string) => Promise<IfcResult> = Client.prototype.getClientObjectConfigs

# Type declaration

▸ (clientId): Promise<IfcResult>

get client config objects

# Parameters
Name Type
clientId string
# Returns

Promise<IfcResult>

# Implementation of

Client.getClientObjectConfigs

# Defined in

api.ts:80 (opens new window)


# getClientProducts

getClientProducts: (clientId: string) => Promise<IfcResult> = Client.prototype.getClientProducts

# Type declaration

▸ (clientId): Promise<IfcResult>

get all products on client

example

const { success, data, message } = await api.getClientProducts('client01.opsi.lan')
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // data returns a array of product information or an empty array
# Parameters
Name Type
clientId string
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.getClientProducts

# Defined in

api.ts:38 (opens new window)


# getClientProductsInstallationStatus

getClientProductsInstallationStatus: (clientId: string) => Promise<IfcResult> = Client.prototype.getClientProductsInstallationStatus

# Type declaration

▸ (clientId): Promise<IfcResult>

get all installed and not installed opsi product for client

example

const { success, data, message } = await api.getClientProductsInstallationStatus('client01.opsi.lan')
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // data returns a array of product information or an empty array
# Parameters
Name Type
clientId string
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.getClientProductsInstallationStatus

# Defined in

api.ts:40 (opens new window)


# getClientSoftware

getClientSoftware: (clientId: string) => Promise<IfcResult> = Client.prototype.getClientSoftware

# Type declaration

▸ (clientId): Promise<IfcResult>

if swaudit is successfully ran on this client you will get a huge array of software information.

example

const { success, data, message } = await api.getClientSoftware('client01.opsi.lan')
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // data returns a array of software information or an empty array
# Parameters
Name Type
clientId string
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.getClientSoftware

# Defined in

api.ts:36 (opens new window)


# getClientsWithOutdatedVersion

getClientsWithOutdatedVersion: (productid: string) => Promise<IfcResult> = Product.prototype.getClientsWithOutdatedVersion

# Type declaration

▸ (productid): Promise<IfcResult>

Get all clients with outdated software version for one product.

example

const { success, data, message } = await api.getClientsWithOutdatedVersion('swaudit');
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // array of client ids
# Parameters
Name Type Description
productid string Any id string.
# Returns

Promise<IfcResult>

Data.

# Implementation of

Product.getClientsWithOutdatedVersion

# Defined in

api.ts:118 (opens new window)


# getGroupClients

getGroupClients: (groupId: string) => Promise<IfcResult> = Group.prototype.getGroupClients

# Type declaration

▸ (groupId): Promise<IfcResult>

get clients from group

example

//return array of clients
const { success, data, message } = await api.getGroupClients('group01')
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // returns array of client ids in group or an error object on fail
[ { groupType: 'HostGroup',
ident: 'HostGroup;group01;grouptestclient.opsi.lan',
type: 'ObjectToGroup',
groupId: 'group01',
objectId: 'grouptestclient.opsi.lan' } ]
# Parameters
Name Type Description
groupId string Group ID
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Group.getGroupClients

# Defined in

api.ts:102 (opens new window)


# getHostGroupInfo

getHostGroupInfo: (groupName: string) => Promise<IfcResult> = Group.prototype.getHostGroupInfo

# Type declaration

▸ (groupName): Promise<IfcResult>

get group info

example

//returns object with group info
const { success, data, message } = await api.getHostGroupInfo('group01')
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data)
{ ident: 'group01',
  description: 'Group description',
  notes: '',
  parentGroupId: null,
  type: 'HostGroup',
  id: 'group01' }
# Parameters
Name Type Description
groupName string Group ID Name
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Group.getHostGroupInfo

# Defined in

api.ts:96 (opens new window)


# getInstallableProductIds

getInstallableProductIds: (clientId: string) => Promise<IfcResult> = Client.prototype.getInstallableProductIds

# Type declaration

▸ (clientId): Promise<IfcResult>

get all installable software packages for one client

# Parameters
Name Type
clientId string
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.getInstallableProductIds

# Defined in

api.ts:54 (opens new window)


# getLoggedInUser

getLoggedInUser: (clientId: string) => Promise<IfcResult> = Client.prototype.getLoggedInUser

# Type declaration

▸ (clientId): Promise<IfcResult>

get logged in user data

# Parameters
Name Type
clientId string
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.getLoggedInUser

# Defined in

api.ts:48 (opens new window)


# getProductInfo

getProductInfo: (productId: any) => Promise<IfcResult> = Product.prototype.getProductInfo

# Type declaration

▸ (productId): Promise<IfcResult>

get detailed Product infos

example

const { success, data, message } = await api.getProductInfo('swaudit')
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // object of detailed product information
# Parameters
Name Type
productId any
# Returns

Promise<IfcResult>

# Implementation of

Product.getProductInfo

# Defined in

api.ts:116 (opens new window)


# getUptimeClient

getUptimeClient: (clientId: string) => Promise<IfcResult> = Client.prototype.getUptimeClient

# Type declaration

▸ (clientId): Promise<IfcResult>

get the update in seconds from client

# Parameters
Name Type
clientId string
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.getUptimeClient

# Defined in

api.ts:56 (opens new window)


# groupNameExists

groupNameExists: (groupName: string) => Promise<IfcResult> = Group.prototype.groupNameExists

# Type declaration

▸ (groupName): Promise<IfcResult>

group name exists

example

//returns boolean
const { success, data, message } = await api.groupNameExists('group01')
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // returns true, false or an error object on fail
# Parameters
Name Type Description
groupName string Group ID Name
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Group.groupNameExists

# Defined in

api.ts:98 (opens new window)


# id

id: number

# Defined in

api.ts:18 (opens new window)


# isClientOn

isClientOn: (clientId: string) => Promise<IfcResult> = Client.prototype.isClientOn

# Type declaration

▸ (clientId): Promise<IfcResult>

is client on or off

# Parameters
Name Type
clientId string
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.isClientOn

# Defined in

api.ts:50 (opens new window)


# password

password: string

# Defined in

api.ts:16 (opens new window)


# rebootClient

rebootClient: (clientId: string) => Promise<IfcResult> = Client.prototype.rebootClient

# Type declaration

▸ (clientId): Promise<IfcResult>

triggers a reboot command on the given clientId

# Parameters
Name Type
clientId string
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.rebootClient

# Defined in

api.ts:62 (opens new window)


# removeClientConfigObject

removeClientConfigObject: (clientId: string, configId: string) => Promise<IfcResult> = Client.prototype.removeClientConfigObject

# Type declaration

▸ (clientId, configId): Promise<IfcResult>

remove a config value for a client

# Parameters
Name Type
clientId string
configId string
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.removeClientConfigObject

# Defined in

api.ts:74 (opens new window)


# removeClientFromGroup

removeClientFromGroup: (clientId: string, groupId: string) => Promise<IfcResult> = Group.prototype.removeClientFromGroup

# Type declaration

▸ (clientId, groupId): Promise<IfcResult>

remove client from group

example

//returns boolean only on super bad data it will return an error message
const { success, data, message } = await api.removeClientFromGroup('grouptestclient.opsi.lan', 'group01')
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // returns also boolean or an error object on fail
# Parameters
Name Type Description
clientId string Client ID
groupId string Group ID
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Group.removeClientFromGroup

# Defined in

api.ts:104 (opens new window)


# renameClient

renameClient: (name: string, newname: string) => Promise<IfcResult> = Client.prototype.renameClient

# Type declaration

▸ (name, newname): Promise<IfcResult>

rename a client

example

//returns boolean only on super bad data it will return an error message
const { success, data, message } = await api.renameClient('client01.opsi.lan', 'client01-renamed.opsi.lan')
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // data returns also true or an error object on fail
# Parameters
Name Type Description
name string old id of the client
newname string new id
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.renameClient

# Defined in

api.ts:44 (opens new window)


# renameGroup

renameGroup: (name: string, newname: string) => Promise<IfcResult> = Group.prototype.renameGroup

# Type declaration

▸ (name, newname): Promise<IfcResult>

example

//returns boolean only on super bad data it will return an error message
const { success, data, message } = await api.renameGroup('group01', 'group01-renamed')
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // returns also boolean or an error object on fail
# Parameters
Name Type Description
name string old id of the group
newname string id
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Group.renameGroup

# Defined in

api.ts:106 (opens new window)


# res

res: IfcResult

# Defined in

api.ts:20 (opens new window)


# sendPopupMessageToClient

sendPopupMessageToClient: (clientId: string, message: string) => Promise<IfcResult> = Client.prototype.sendPopupMessageToClient

# Type declaration

▸ (clientId, message): Promise<IfcResult>

sent a popup message to the client that appears instantly on the client desktop.

# Parameters
Name Type
clientId string
message string
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.sendPopupMessageToClient

# Defined in

api.ts:68 (opens new window)


# setClientConfigObject

setClientConfigObject: (clientId: string, configId: string, value: string | number | boolean) => Promise<IfcResult> = Client.prototype.setClientConfigObject

# Type declaration

▸ (clientId, configId, value): Promise<IfcResult>

set a config value for a client

# Parameters
Name Type
clientId string
configId string
value string | number | boolean
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.setClientConfigObject

# Defined in

api.ts:72 (opens new window)


# setUefiBoot

setUefiBoot: (clientId: string) => Promise<IfcResult> = Client.prototype.setUefiBoot

# Type declaration

▸ (clientId): Promise<IfcResult>

# Parameters
Name Type
clientId string
# Returns

Promise<IfcResult>

# Implementation of

Client.setUefiBoot

# Defined in

api.ts:76 (opens new window)


# shutdownClient

shutdownClient: (clientId: string) => Promise<IfcResult> = Client.prototype.shutdownClient

# Type declaration

▸ (clientId): Promise<IfcResult>

triggers a shutdown command on the given clientId

# Parameters
Name Type
clientId string
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.shutdownClient

# Defined in

api.ts:64 (opens new window)


# startClient

startClient: (clientId: string) => Promise<IfcResult> = Client.prototype.startClient

# Type declaration

▸ (clientId): Promise<IfcResult>

triggers a wake-on-lan command from the opsi server to the given clientId. Wake on Lan needs to be activated and the client.

# Parameters
Name Type
clientId string
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.startClient

# Defined in

api.ts:66 (opens new window)


# uefiBootEnabled

uefiBootEnabled: (clientId: string) => Promise<IfcResult> = Client.prototype.uefiBootEnabled

# Type declaration

▸ (clientId): Promise<IfcResult>

shows if uefi is enabled or disabled

# Parameters
Name Type
clientId string
# Returns

Promise<IfcResult>

boolean or error

# Implementation of

Client.uefiBootEnabled

# Defined in

api.ts:84 (opens new window)


# unsetUefiBoot

unsetUefiBoot: (clientId: string) => Promise<IfcResult> = Client.prototype.unsetUefiBoot

# Type declaration

▸ (clientId): Promise<IfcResult>

# Parameters
Name Type
clientId string
# Returns

Promise<IfcResult>

# Implementation of

Client.unsetUefiBoot

# Defined in

api.ts:78 (opens new window)


# updateClient

updateClient: (clientObject: IfcHost) => Promise<IfcResult> = Client.prototype.updateClient

# Type declaration

▸ (clientObject): Promise<IfcResult>

update client

example

//returns boolean only on super bad data it will return an error message
const { success, data, message } = await api.updateClient(
{ident: 'client01.opsi.lan', note: 'add update note'}
)
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // data returns also true or an error object on fail
# Parameters
Name Type Description
clientObject IfcHost group object with ident key
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Client.updateClient

# Defined in

api.ts:28 (opens new window)


# updateHostGroup

updateHostGroup: (groupObject: IfcGroup) => Promise<IfcResult> = Group.prototype.updateHostGroup

# Type declaration

▸ (groupObject): Promise<IfcResult>

update group

example

//returns boolean only on super bad data it will return an error message
const { success, data, message } = await api.updateHostGroup(
{ident: 'group01', note: 'add update note'}
)
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // data returns also true or an error object on fail
# Parameters
Name Type Description
groupObject IfcGroup group object with ident key
# Returns

Promise<IfcResult>

Object with result data

# Implementation of

Group.updateHostGroup

# Defined in

api.ts:94 (opens new window)


# updateOutdatedClients

updateOutdatedClients: (productid: string) => Promise<IfcResult> = Product.prototype.updateOutdatedClients

# Type declaration

▸ (productid): Promise<IfcResult>

Update clients with outdated software.

example

const { success, data, message } = await api.updateOutdatedClients('swaudit');
console.log(success) // if all data are ok then this should return true else false
console.log(message) // message is empty if success is true. if success is false there is a error message
console.log(data) // array of client ids
# Parameters
Name Type Description
productid string Any id string.
# Returns

Promise<IfcResult>

Data.

# Implementation of

Product.updateOutdatedClients

# Defined in

api.ts:120 (opens new window)


# username

username: string

# Defined in

api.ts:14 (opens new window)

# Methods

# getOpsiServerInfo

getOpsiServerInfo(): Promise<IfcResult>

Get server infos.

example // returns array with objects of server data api.getOpsiServerInfo()

# Returns

Promise<IfcResult>

Data.

# Defined in

api.ts:209 (opens new window)


# getOpsiVersion

getOpsiVersion(): Promise<IfcResult>

Get opsi version or false.

example // returns a string of the opsi version or false api.getOpsiVersion()

# Returns

Promise<IfcResult>

Data.

# Defined in

api.ts:153 (opens new window)


# getServerIDs

getServerIDs(): Promise<IfcResult>

Get all server ids.

example // returns array of server ids api.serverIDs()

# Returns

Promise<IfcResult>

Data.

# Defined in

api.ts:167 (opens new window)


# isAuthenticated

isAuthenticated(): Promise<IfcResult>

Is api user authenticated.

example // returns boolean if user is logged in or not api.isAuthenticated()

# Returns

Promise<IfcResult>

Data.

# Defined in

api.ts:181 (opens new window)


# isUserAdmin

isUserAdmin(): Promise<IfcResult>

Is api user admin.

example // returns if user has admin rights api.isUserAdmin()

# Returns

Promise<IfcResult>

Data.

# Defined in

api.ts:195 (opens new window)


# reduceReturnClientObject

reduceReturnClientObject(result, clientId): IfcResult

# Parameters

Name Type
result any
clientId any

# Returns

IfcResult

# Defined in

api.ts:243 (opens new window)


# resetResult

Protected resetResult(): Object

# Returns

Object

Name Type
data boolean
message string
success false

# Defined in

api.ts:300 (opens new window)


# returnOneResult

returnOneResult(result, notFoundMessage): IfcResult

manipulate the result to an error or to one return object

# Parameters

Name Type Description
result any IfcResult to manipulate
notFoundMessage any message string that returns if result is empty

# Returns

IfcResult

  • nice IfcResult with useful data

# Defined in

api.ts:232 (opens new window)


# sendRequest

Private sendRequest(method, params, id): Promise<IfcResult>

Generate api call actions.

# Parameters

Name Type Description
method string Api function name to call.
params any[] Array of method parameters.
id number Id number.

# Returns

Promise<IfcResult>

# Defined in

api.ts:265 (opens new window)