Creating custom tables in the database

Created by Oleg Agapov, Modified on Thu, 06 Jul 2023 at 09:10 AM by Oleg Agapov

For logging user state history and webhooks



1. Edit TCXWebAPI.ini

Add in [General] section TCXWebAPI.ini


;DB Creation SecureKey
API_SPECIAL_KEY = {AccessKey} (example Vm8ck9ms1j)


Add in [Webhooks] section TCXWebAPI.ini


;Logging User state history
DBS_URL = 127.0.0.1

;Logging Webhook history
DBL_URL = 127.0.0.1


Restart WebAPI service


2. Create custom tables 


Use (with example AccessKey) for create tables in custome database 'user_state' on the same PostgreSQL Instance (127.0.0.1)


https://{{3CXFQDN}}/webapi/Vm8ck9ms1j/table.create?name=operator_state_history 


and


https://{{3CXFQDN}}/webapi/Vm8ck9ms1j/table.create?name=webhook_history



Restart WebAPI service



For getting Records


Use 


{"query":"SELECT * FROM public.operator_state_history order by date desc;","count":"10","db_name":"user_state"}


and


{"query":"SELECT * FROM public.webhook_history order by date desc;","count":"10","db_name":"user_state"}



PS. After adding the tables, we recommend to delete the API_SPECIAL_KEY for security reasons




Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article