UserSide API Key EN

Материал из WiKi - UserSide

en | ru

An API ERP UserSide and the interaction of external modules requires an API key.

The key is a completely arbitrary text string, but it cannot be empty.

The API key configuration is shown below.

From version 3.18 and newer

In the main configuration file

For versions 3.19 and above:

[USERSIDE_DIRECTORY]/public//main/config/config.php

For versions up to 3.19:

[USERSIDE_DIRECTORY]/userside3/main/config/config.php


add (or configure) a $apiKeyArray variable where you can configure access by key and IP address. You can also specify specific names of API sections that are allowed to be used with this key.

$apiKeyArray = [
   [
       'key' => 'mainKey',
       'ip' => '*'
   ],
   [
       'key' => 'key-local',
       'ip' => '127.0.0.1',
       'section' => [
           'customer',
           'node'
       ]
   ]
];

IP addresses must be specified in text form. "*" - means the use of any IP-address. If you need to use several IP addresses for one key - then add new array elements. For example:

$apiKeyArray = [
   [
       'key' => 'mainKey',
       'ip' => '*'
   ],
   [
       'key' => 'key-local',
       'ip' => '127.0.0.1'
   ],
   [
       'key' => 'key-local',
       'ip' => '192.168.0.1',
       'section' => [
           'customer',
           'node'
       ]
   ],
   [
       'key' => 'key-local',
       'ip' => '192.168.0.50',
       'section' => [
           'task',
           'node'
       ]
   ]
];

For version 3.17

In the main configuration file [USERSIDE_DIRECTORY]/userside3/main/config/config.php add (or configure) a $apiKeyArray variable where you can configure access by key and IP address.

$apiKeyArray = [
   [
       'key' => 'mainKey',
       'ip' => '*'
   ],
   [
       'key' => 'key-local',
       'ip' => '127.0.0.1'
   ]
];

IP addresses must be specified in text form. "*" - means the use of any IP-address. If you need to use several IP addresses for one key - then add new array elements. For example:

$apiKeyArray = [
   [
       'key' => 'mainKey',
       'ip' => '*'
   ],
   [
       'key' => 'key-local',
       'ip' => '127.0.0.1'
   ],
   [
       'key' => 'key-local',
       'ip' => '192.168.0.1'
   ],
   [
       'key' => 'key-local',
       'ip' => '192.168.0.50'
   ]
];

For versions before 3.17

In the main configuration file [USERSIDE_DIRECTORY]/userside3/main/config/config.php add (or customise) a $zapikey variable where you type in your key.

$zapikey = 'key';