# TES: Install TESAPI service and TESIMPORT program that uses the API

**URL:** <https://discourse.datatex.co.za/t/tes-install-tesapi-service-and-tesimport-program-that-uses-the-api/317>\
**Category:** Telephone Management ( TNG and TES )\
**Tags:** linux, tes\
**Created:** [July 20, 2023, 9:20am UTC](https://discourse.datatex.co.za/t/tes-install-tesapi-service-and-tesimport-program-that-uses-the-api/317 "2023-07-20T09:20:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![LeonvanHeerden](https://discourse.datatex.co.za/letter_avatar_proxy/v4/letter/l/51bf81/32.png) [@LeonvanHeerden](https://discourse.datatex.co.za/u/LeonvanHeerden)\
**Post date:** [July 20, 2023, 9:20am UTC](https://discourse.datatex.co.za/t/tes-install-tesapi-service-and-tesimport-program-that-uses-the-api/317/1 "2023-07-20T09:20:49Z")

</div>

These steps allows you to install the TESAPI initial service and the TESIMPORT program.  
**Requirements**

- Working TES
- Internet access to download the tes updates
- MyUpdates/tes folder

**Install Files**

- Check that the files are not already installed

`ls -l /opt/datatex/tes/tesapi/`

- **DO NOT OVERWRITE THE FILES IF THEY ARE ALREADY THERE.**

`cd /root/MyUpdates/tes`  
`tar xvjf tesapi.tar.bz2 -C /opt/datatex/tes`

- Copy the latest server that is available and enable the MyAccount Updates.

`cp /root/MyUpdates/tes/tesapiserver_1.0.0.6 /opt/datatex/tes/tesapi/tesapiserver`

**Configuration**  
/opt/datatex/tes/tesapi/tesapiserver.ini

- Make sure the DB and login details are configured.

```auto
[DATABASE]
HOST=127.0.0.1
PATH=/opt/datatex/tes/DB/tes.dbf
USER=tes
PASSWORD=testicle

```

- Start the API server to setup the DB.

```auto
cd /opt/datatex/tes/tesapi
./starttesapiserver

```

- Check the logs that the updates worked.

`less /opt/datatex/tes/tesai/logs/20230720.log`

**Setup API Key**

- Run the update script

```auto
cd /opt/datatex/tes/tesimport
bash ./setupapikey.sh

```

- Copy the “key” value from the result:

`{ "funcname" : "key/update", "key" : "47F74B02-FCC9-403F-8727-FDBE4275F010", "keyname" : "47F74B02-FCC9-403F-8727-FDBE4275F010", "msg" : "Master key was created successfully", "msgcode" : 200, "name" : "", "updatekey" : "" }`

- Update the tesuserimport.ini

`vi /opt/datatex/tes/tesimort/tesuserimort.ini`

- Set the GUIDKEY to the KEY value copied.

`GUIDKEY=47F74B02-FCC9-403F-8727-FDBE4275F010`

- Set the Default Company and Branch values:

```auto
COMPANY=COMPANYNAME
DEFAULTBRANCH=BRANCHNAME

```
