TES API information

This document shows how to use either the JSON or the CSV format of the data to import using the TESImport Utility on the TES server’s command line.

TES API JSON User import format

( Currently unreleased)
The TESAPI service needs to be installed for this facility to function.
The TESAPI service uses the TES certificate and runs on port 8080

NOTE!! each field needs to be in double quotes. This is stating each value as a string. Liek the example below

The import facility can import JSON data containing user details.
The default for the JSON is an array of JSON objects containing the following fields:

  • userid - compulsory : Unique ID used for the TES user. This is the key value to update an user that was previously added
  • extension - optional : Extension number that will occur on the call data
  • pincode - optional : Pin code that will appear in the call data.
  • username - optional : Username that will be associated with the Unique ID , Extension and Pin.
  • branch - compulsory : Users, extensions and pins have to be allocated to a Branch in TES. Can be omitted if a default branch is provided in the INI file.
  • department - compulsory : Same as branches.
  • email - optional : If this value is provided, the email address will be usable as a login in TES with the USERID used as the initial default password.

INFO

  • All fields are string fields.
  • Optional fields can be omitted and they will not be updated.
  • The value “_blank_” can be used to clear a field that was previously populated - it only applies to username, department, and email.

e.g.

[{"userid":"1234",
"extension":"4567",
"username":"John Doe",
"department":"Development",
"branch":"Cape Town", 
"email":"john@datatex.co.za"},
{"userid":"1235","extension":"4455","username":"Jane Doe","department":"Admin","branch":"Cape Town", "email":"jane@datatex.co.za"}]

INI file settings for TESIMPORT
Default INI file

[SETTINGS]
#API key values. 
COMPANY=DATATEX
GUIDKEY=C1B6121F-6C41-4451-8B16-131C9671EA7E
BASEURL=https://127.0.0.1:8080/
DEFAULTBRANCH=DHS HO
DEFAULTCONTROLLERID=MITEL1

#Branch settings
DEFAULTAREACODES=01,02,03,04,05
DEFAULTINTERNATIONALRATE=0.9
DEFAULTLOCALRATE=0.19
DEFAULTMOBILERATE=0.24
DEFAULTNATIONALRATE=0.19

#Other settings. 
VERBOSELOGS=0
CSVDELIMITER=|
USEFILTER=0

The DEFAULT values are used if a new Branch is created.

In the INI file, you specify the TES company and controller id.
All users in the provided update JSON file must be for a single company and single controller id.

You can also set up a mapping in the INI file, and use different field names:

[MAPPING]
Branch=[division]
Department=[departmentNumber]
UserID=[employeeNumber]
Username=[displayName]
Extension=[telephoneNumber]
Email=_blank_
Pincode=[usercode]

and the file would then be something like:

[{"telephoneNumber":"4567",
"displayName":"John Doe",
"department":"Development",
"employeeNumber":"1234",
"division":"Cape Town",
"userPrincipalName":"john@datatex.co.za",
"departmentNumber":"12"}]

CSV File format for import:

INI file setting allows the config of the delimeter: CSVDELIMITER=|
If you have the Mapping setup as above, the values used on the right, must be your CSV file heading.
These values are case sensitive and there should not be spaces before and after the “|” characters.

No Mapping defined in a MAPPING section.

Branch|Department|UserID|Username|Extension|Email|PinCode|

Mapping used. ( email is blank in the above case. )

division|departmentNumber|employeeNumber|displayName|telephoneNumber | |

Use tesuserimport to load this CSV file.

./tesuserimport --company "COMPANYNAME" test.csv

The logs ill show entries that failed to load and the reason it failed.
Existing entries that are already on the Database will be updated wit the CSV file data.