Request for a description of the server's objects' classes

Every TRASSIR object has an associated class (type). The class defines the object's possible states and the applicable methods. There are a large number of different classes in TRASSIR. Use the /objects command to find out what class an object belongs to. The /classes command is used to request the class's parameters.

Example of a request:

        https://192.168.1.200:8080/classes/Channel?sid=gbnVFUit  

Tip

Note that class names (Channel in our example) are case-sensitive.

Example of a server response:

{
    "possible_states_vector" : [
        {
            "name" : "signal",
            "values" : [
                    "No Signal",
                    "Signal"
            ]
        },
        {
            "name" : "motion",
            "values" : [
                    "No Motion",
                    "Motion"
            ]
        },
        {
            "name" : "recording",
            "values" : [
                    "Not Recording",
                    "Recording"
            ]
        },
        {
            "name" : "recording_on_device",
            "values" : [
                    "Not Recording (on device)",
                    "Recording (on device)"
            ]
        },
        {
            "name" : "sound_detector",
            "values" : [
                "Disabled",
                "Silent",
                "Loud"
            ]
        }
    ],
    "methods" : [
        {
            "name" : "record",
            "parameters" : [
                {
                    "name" : "turn_on_record",
                    "type" : "integer"
                }
            ]
        },
        {
            "name" : "record_on",
            "parameters" : [
            ]
        },
        {
            "name" : "record_off",
            "parameters" : [
            ]
        },
        {
            "name" : "set_watermark",
            "parameters" : [
                {
                    "name" : "watermark_text",
                    "type" : "string"
                },
                {
                    "name" : "watermark_position",
                    "type" : "integer"
                },
                {
                    "name" : "timestamp_position",
                    "type" : "integer"
                }
            ]
        },
        {
            "name" : "manual_record_start",
            "parameters" : [
            ]
        },
        {
            "name" : "manual_record_stop",
            "parameters" : [
            ]
        },
        {
            "name" : "ptz_preset",
            "parameters" : [
                {
                    "name" : "preset_n",
                    "type" : "integer"
                }
            ]
        },
        {
            "name" : "screenshot",
            "parameters" : [
            ]
        },
        {
            "name" : "screenshot_ex",
            "parameters" : [
                {
                    "name" : "timestamp",
                    "type" : "string"
                },
                {
                    "name" : "directory",
                    "type" : "string"
                }
            ]
        },
        {
            "name" : "screenshot_v2",
            "parameters" : [
                {
                    "name" : "time_YYYYMMDD_HHMMSS",
                    "type" : "string"
                },
                {
                    "name" : "screenshot_filename",
                    "type" : "string"
                },
                {
                    "name" : "screenshot_folder",
                    "type" : "string"
                },
                {
                    "name" : "make_thumb",
                    "type" : "integer"
                }
            ]
        }
    ]
}  

In this example, the response contains:

     "possible_states_vector" : [
        {
            "name" : "signal",
            "values" : [
                    "No Signal",
                    "Signal"
            ]
        }
    ]  

  • "possible_states_vector" - a description block for the statuses of an object of the given class and their possible states;
  • "name" : "signal" - a status name; in this example, it indicates if the channel has a signal;
  • "values" : - the possible values; in this example: "No Signal" – there is no signal, "Signal" – there is a signal.

In this example, the response contains:

     "methods" : [
        {
            "name" : "ptz_preset",
            "parameters" : [
                {
                    "name" : "preset_n",
                    "type" : "integer"
                }
            ]
        }
    ]  

  • "methods" : - a description block for the methods that are applicable to an object of the given class;
  • "name" : "ptz_preset" - a method name; in this example, to switch a PTZ camera to a specific camera preset;
  • "parameters" : - the required parameters;
  • "name" : "preset_n", "type" : "integer" - a parameter name and type; in this example, the camera preset number, formatted as an integer.