Request for archive state

Important

The request of the archive state is possible on;y after receiving the archive stream on the following algorithm:

  1. Execute Token request with stream=archive_main or stream=archive_sub.
  2. Make the stream request by the Token.
  3. Run the command to request the archive status.

Example of the archive state request:

        https://192.168.1.200:8080/archive_status?type=[state_type]&sid=sid=[session_id]  

Key elements of the request:

  • type=[state_type] - The type of state being requested:
    • state - The archive's current state;
    • calendar - The archive's calendar;
    • timeline - The archive's timeline.
  • sid=[session_id] - The identifier for the session in which the request is being made (see Get a session ID).

Example of a request for an archive's current state:

        https://192.168.1.200:8080/archive_status?type=state&sid=e03qD0eg  

Example of a server response:

[
    {
        "token" : "iWlB1MlD",
        "time" : "2014-02-24 14:17:00",
        "speed" : "0.000000",
        "state" : "1",
        "state_desc" : "",
        "state_time" : "1393237022489381"
    }
]  

In this example, the response contains:

  • "token" : "iWlB1MlD" - A unique Token to obtain the archive's video (see Getting video and audio streams);
  • "time" : "2014-02-24 14:17:00" - date and time of the replayed archive;
  • "speed" : "0.000000" - current speed of the archive replay;
  • "state" : "1" - The archive's current state:
    • 1 - Archive playback is stopped;
    • 2 - Archive is being played back;
    • 4 - Seek operation in progress;
    • 8 - There was an error;
    • 10 - The disks are busy.
  • "state_desc" : "" - description of state of the replayed archive;
  • "state_time" : "1393237022489381" -time of the archive state change in the format.

Example of a request for an archive's calendar:

  https://192.168.1.200:8080/archive_status?type=calendar&sid=e03qD0eg  

Example of a server response:

[
    {
        "token" : "iWlB1MlD",
        "calendar" : [
            "2014-02-20",
            "2014-02-21",
            "2014-02-24"
            ]
    }
]  

In this example, the response contains:

  • "token" : "iWlB1MlD" - A unique Token to obtain the archive's video (see Getting video and audio streams);
  • "calendar" : [] - list of dates, containing the archive.

    Tip

    The "calendar" : [] contains the list of dates, corresponding to the given Token, not all server channels.

Example of a request for an archive's timeline:

  https://192.168.1.200:8080/archive_status?type=timeline&sid=e03qD0eg  

Example of a server response:

[
    {
        "token" : "iWlB1MlD",
        "day_start" : "2014-02-24",
        "timeline" : [
            {
                "begin" : "43090",
                "end" : "43094"
            },
            {
                "begin" : "43149",
                "end" : "44506"
            },
            {
                "begin" : "44592",
                "end" : "44844"
            },
            {
                "begin" : "45201",
                "end" : "50573"
            },
            {
                "begin" : "50628",
                "end" : "50628"
            },
            {
                "begin" : "51088",
                "end" : "51327"
            }
        ]
    }
]  

In this example, the response contains:

  • "token" : "iWlB1MlD" - A unique Token to obtain the archive's video (see Getting video and audio streams);
  • "day_start" : "2014-02-24" - date of the replayed archive;
  • "timeline" : [] - list of the continuous archive fragments where:

    • "begin" : "" - time of the archive fragment start;
    • "end" : "" - time of the archive fragment end.

    Tip

    The time of the archive fragment start and end is specified in seconds from the start of the date, ranging 0 to 86400.