Automatic deletion of conferences with TrueConf API
Starting from the version 5.3.0, TrueConf Server and TrueConf Server Free support automatic deletion of the conferences that have already ended. To learn more about this way of deleting events, refer to the TrueConf Server administrator guide. This article will show how you can do it with the help of a program which is run on a recurring basis and which uses TrueConf Server API.
To see the full list of TrueConf Server API features, please read our documentation.
Problem description
If you organize and schedule a lot of meetings, you may need to clear past conferences (e.g. those that have finished for more than a month).
However, you may not simply delete all the meetings that are not launched (i.e. “stopped”), because all currently inactive conferences (even those that have not been started yet) are assigned with a “stopped” status. Moreover, you have to exclude the conferences with an automatic start schedule, e.g., weekly recurring meetings, from the removal list.
Thus, you need to delete scheduled one-time events which have finished for a certain number of days.
To see a code example of this case, please visit our GitHub.
Step 1. Determining a specific date and time for removing the meetings
You need to choose a date: all meetings that have been created before the specified date will be deleted. In order to determine this date you should subtract the required number of days from the current date. The result should be converted in Unix Timestamp format. For instance, if you need to remove the сonferences that have finished by June 1, 2021, 9 p.m. UTC you will get 1622494800.
Step 2. Getting conference list
You can obtain a list of conferences by using the Get Conference List method and specifying the additional parameter state=stopped.
As a result you will get JSON with Conference object list.
If you are creating a conference with the help of the Create Conference API request and do not want to delete all conferences that have already ended, you can reduce the size of the list received during Step 2. To do it, mark the conferences that have to be deleted with a certain tag. For example, you can set the parameter "tags":["delete"]. In this case you will be able to filter the list of ended conferences by using the tag=delete parameter in your GET request.
|
1 |
https://server.example.com//api/v3.11/conferences?tag=delete |
Step 3. Searching for the conferences to be deleted
For each conference from the conference object list you should do the following:
- Check a conference schedule type by using Schedule object (it has to be a one-time meeting
"type":1). - If the conference ending time which equals its starting time
start_timeplus its durationdurationis less than you get in step 1, save its ID and do the next step.
Step 4. Deleting a conference
Delete a conference by using DELETE-request Delete Conference, where you should specify its ID.
If you want to use this method for virtual rooms, you need to mark a conference with a tag when creating or editing this event (refer to the description of the tags parameter). Later it will be possible to delete all conferences from the received list if they were marked with this tag.