type_library

To get the library of unit types, use the file/type_library method. The keys from the library are used as values of the vehicle_class profile field. For details, see update_profile_field.

Endpoint

Copied!
svc=file/type_library&params={
  "lang": "<text>"
}

Parameters

The request can contain the following parameter:

Parameter Description
lang Optional. Two-letter language code, for example, en or es. The names and comments in the response are translated into this language. If the parameter isn’t specified, the language of the current session is used.

Response

If the request is completed successfully, the library is returned as a tree with three levels: type, subtype, and kind. For example:

Copied!
{
  "items": [
    {
      "name": "",
      "items": [
        {
          "key": "vehicle",
          "name": "Vehicle",
          "items": [
            {
              "name": "",
              "items": [
                {
                  "key": "cargo_transport",
                  "name": "Cargo transport",
                  "items": [
                    {
                      "name": "",
                      "items": [
                        {
                          "key": "van",
                          "name": "Van",
                          "comment": "Light commercial vehicle, minivan"
                        },
                        ...
                      ]
                    }
                  ]
                },
                ...
              ]
            }
          ]
        },
        ...
      ]
    }
  ]
}

The tree contains the following elements:

Element Description
Group An object with the name and items keys. It contains the elements of the next level. The name of the group can be empty.
Type or subtype An object with the key, name, and items keys. key is the unique key of the element, and name is its translated name. items contains the groups of the next level.
Kind An object with the key, name, and comment keys. comment is a translated description of the kind and can be empty.

Some types and subtypes contain a kind with an empty name and a key that starts with empty_, for example, empty_cargo. Use such a key to save a unit type when only its type or subtype is known.

If the request fails, an error code is returned.

Error codes

Error code Description
3 The type library isn’t available on the server.
4 The lang value doesn’t consist of two characters.

If you find a mistake in the text, please select it and press Ctrl+Enter.