Remote archive export

Unlike the command describe in section Local archive export the Remote archive export command allows to request an archive fragment from any TRASSIR server and download it.

Important

Consider the following when using the Remote archive export command:

  • The remote archive export tasks are not displayed on TRASSIR control panel.
  • Only one remote archive export task can be executed at time. Besides, the new task of the remote archive export will be executed only after the existing tasks of local archive export are completed. The new local archive export tasks will not start until the current remote archive export task completes.
  • The time period within which the archive is being exported should not exceed 30 minutes.
  • The exported file is saved in .mp4.

The remote archive export is performed the following way:

  1. Request for remote archive export task creation

    Example of a request:

    https://192.168.1.200:8080/jit-export-create-task?sid=MdFYYrjy   

    The request is sent using the POST method. The body of the request should contain the following data in JSON format:

    {
    	"resource_guid": "zwzmklKi",
    	"start_ts": 1596552540000000,
    	"end_ts":   1596552600000000,
    	"is_hardware": 0,
    	"prefer_substream": 0
    }   

    where:

    • "resource_guid": "zwzmklKi" - channel GUID;
    • "start_ts": 1596552540000000 - the exported archive fragment start time;
    • "end_ts": 1596552600000000 - the exported archive fragment end time;
    • "is_hardware": 0 - archive source (0 - TRASSIR archive, 1 - device archive);
    • "prefer_substream": 0 - archive stream (0 - main stream, 1 - sub stream).

    Tip

    The time is in microseconds in UNIX time format based on the timezone configured on server.

    Example of a server response:

    {
    	"success" : "1",
    	"task_id" : "JgZN323E"
    }   

    In this example, the response contains:

    • "success" : "1" - request successful message;
    • "task_id" : "JgZN323E" - unique task id.

    If the request body contains an interval longer than 30 minutes or there is no archive in the specified interval, the server will respond with an error message:

    {
    	"success" : "0",
    	"error_code": "bad interval"
    }   
  2. Request to get export file

    Tip

    Request to get export file should be executed within 10 seconds after task creation request execution. After 10 seconds, the remote export task will be deleted.

    Example of a request:

    https://192.168.1.200:8080/jit-export-download?sid=MdFYYrjy&task_id=JgZN323E   

    The request is sent by GET method. The parameters of the request contains the following data:

    • sid=MdFYYrjy - unique session id;
    • task_id=JgZN323E - previously created task id.

    The server will send the exported file as a response.

  3. Task state request

    Example of a request:

    https://192.168.1.200:8080/jit-export-task-status?sid=MdFYYrjy   

    The request is sent using the POST method. The body of the request should contain the following data in JSON format:

    {
    	"task_id": "JgZN323E"
    }   

    where:

    • "task_id": "JgZN323E" - previously created task id.

    Example of a server response:

    {
    	"active" : true,
    	"done" : false,
    	"progress" : 3,
    	"sended" : 30456,
    	"success" : 1
    }   

    In this example, the response contains:

    • "active" : true - the state of the task (true - the task is processing, false - the task is not processing);
    • "done" : false - task completion identifier on the server (true - the task successfully completed, false - the task is not completed);
    • "progress" : 3 - task completion percentage, from 0 to 100;
    • "sended" : 30456 - the number of video bytes sent by the server;
    • "success" : 1 - successful request message.
  4. Request for remote export task removal

    Example of a request:

    https://192.168.1.200:8080/jit-export-cancel-task?sid=MdFYYrjy&task_id=JgZN323E   

    The request is sent by GET method. The parameters of the request contains the following data:

    • sid=MdFYYrjy - unique session id;
    • task_id=JgZN323E - id of the task to be deleted.

    Example of a server response:

    {
    	"success" : "1"
    }