Add an Archive Task

Add an archive task to archive recording files or backup files to an archive server.

Request URL

POST {base_url}/{api_path}/archive_task/create?access_token={access_token}

Request parameters

Parameter Required Type Description
name Yes String The name of the archive task.
file_type Yes String The type of files to archive.

Valid value:

  • recording_files
  • backup_files
time_range Yes String The time range of the files to archive.

Valid value:

  • today
  • yesterday
  • last_7days
  • last_30days
  • this_month
  • last_month
  • custom: A custom time range.
    Note: If set to custom, both time_begin and time_end must be specified.
time_begin No String The start time of the archive time range, in the system date and time format.
Note: This parameter is required when time_range is custom.
time_end No String The end time of the archive time range, in the system date and time format.
Note:
  • This parameter is required when time_range is custom.
  • The value must be later than time_begin, and the interval between the two values cannot exceed 31 days.
freq_type Yes String The execution frequency of the archive task.

Valid value:

  • now: Executive the archive task once immediately.
  • daily: Executive the archive task every day.
  • weekly: Executive the archive task every week.
  • monthly: Executive the archive task every month.
freq_week No Integer The day of the week on which the archive task is executed.

Valid value:

  • 1: Monday.
  • 2: Tuesday.
  • 3: Wednesday.
  • 4: Thursday.
  • 5: Friday.
  • 6: Saturday.
  • 7: Sunday.
Note: This parameter is required when freq_type is weekly.
freq_day No Integer The day of the month on which the archive task is executed.

Valid value: 1 to 31, where -1 represents the last day of the month.

Note: This parameter is required when freq_type is monthly.
freq_time No String The execution time of the archive task, in 24-hour format.
Note: This parameter is required when freq_type is not now.
record_file_format No String The format of the recording files.
Note: This parameter is required when file_type is recording_files.

Valid value:

  • wav: WAV format.
  • mp3: MP3 format.
auth_info_id Yes Integer The ID of the associated archive server.
Note: You can obtain the ID using the Query Archive Server List interface.
file_path No String The target path for archived files on the archive server.
Note: This parameter takes effect only when the associated archive server's server_type is ftp or sftp.
bucket_name No String The name of the storage bucket.
Note: This parameter takes effect only when the associated archive server's server_type is amazon_s3 or google_storage.
bucket_path No String The target path prefix within the storage bucket.
region No String The region of the cloud storage.
site_id No String The ID of the SharePoint site.
Note:
  • This parameter takes effect only when the associated archive server's server_type is sharepoint.
  • You can obtain the ID using the Query Bucket List interface with bucket_info_type set to 3.
site_name No String The name of the SharePoint site.
Note:
  • This parameter takes effect only when the associated archive server's server_type is sharepoint.
  • You can obtain the ID using the Query Bucket List interface with bucket_info_type set to 3.
drive_id No String The ID of the SharePoint document library.
Note:
  • This parameter takes effect only when the associated archive server's server_type is sharepoint.
  • You can obtain the ID using the Query Bucket List interface with bucket_info_type set to 3.
drive_name No String The name of the SharePoint document library.
Note:
  • This parameter takes effect only when the associated archive server's server_type is sharepoint.
  • You can obtain the ID using the Query Bucket List interface with bucket_info_type set to 3.
path_id No String The ID of the target SharePoint folder.
Note: This parameter takes effect only when the associated archive server's server_type is sharepoint.
storage_method No String The method used to store archived files.

Valid value:

  • create_folder_once: Create a folder named "FileType-TaskName" under the selected path and store files within it.
  • create_folder_each_time: Create a folder named "FileType-TaskName-ExecutionDate" under the selected path each time the task executes, and store files within it.
  • create_folder_reuse: Create a folder named "FileType-TaskName" under the selected path during the first execution, and store files from subsequent executions in the same folder.
  • direct_save: Save the archived files directly to the selected path without creating a folder.
Note: This parameter cannot be set to create_folder_once when freq_type is NOT now.
enb_skip_achive_file No Integer Whether to skip the recording files that have already been archived.

Valid value:

  • 0: Archive the recording files again.
  • 1: Skip the recording files that have already been archived.
enb_delete_local_file No Integer Whether to delete the local files after archiving.

Valid value:

  • 0: Keep the local files.
  • 1: Delete the local files.
enable_retention No Integer Whether to enable the file retention.

Valid value:

  • 0: Disable file retention.
  • 1: Enable file retention.
retention_type No String The retention mode.
Note: This parameter is required when enable_retention is 1.

Valid value:

  • quantity: Retain files by quantity.
  • days: Retain files by days.
retention_unit No String The retention unit.
Note: This parameter is required when enable_retention is 1.

Valid value:

  • folder: Apply retention to folders.
    Note: The value folder can be used only when storage_method is create_folder_each_time.
  • file: Apply retention to files.
file_rotation_num No Integer The retention limit, measured according to retention_type.
Note: This parameter takes effect only when enable_retention is 1.
file_organization_by_date No Integer Whether to organized the archived files by date.

Valid value:

  • 0: Do Not organize archived files by date.
  • 1: Organize archived files by date.

Response parameters

Parameter Type Description
errcode Integer Returned error code.
  • 0: Succeed.
  • Non-zero value: Failed.
Note: You can check the error code and error message in Error Code and Error Message.
errmsg String Returned message.
  • SUCCESS: Succeed.
  • FAILURE: Failed.
id Integer The ID of the created archive task.
upper_limited Integer The upper limit of archive tasks, returned when errcode is 60002 (the maximum is reached).

Example

Request example

POST /openapi/v1.0/archive_task/create?access_token=gwakjgu9ZBUfz36wql4ndsVKkryI0kdj HTTP/1.1
Host: 192.168.5.150:8088
Content-Type: application/json
{
  "name": "January-Backup",
  "auth_info_id": 9,
  "file_type": "backup_files",
  "time_range": "today",
  "freq_type": "now",
  "storage_method": "create_folder_once",
  "enb_skip_achive_file": 0,
  "enb_delete_local_file": 0,
  "file_organization_by_date": 0
}

Response example

HTTP/1.1 200 OK
{
  "errcode": 0,
  "errmsg": "SUCCESS",
  "submsg": "",
  "id": 12,
  "upper_limited": 0
}