Zum Inhalt

Web API (beta)

Warning

Currently, the Web API functionality is only available in beta mode. To activate the beta mode of LOGINventory, follow this instruction!

The LOGINventory Web API can be used to query data from the LOGINventory database using HTTP GET Requests. This type of interface is suitable for various application scenarios, e.g. to fetch individual live data with another system directly from LOGINventory, or to perform mass exports to third party systems. Possible scenarios are described in more detail below.

Setting up Web API Endpoints

To enable access via the Web API, a Web API endpoint must be published.

Important

A Web API endpoint defines the "entry point" for accesses. The query on which the endpoint is defined thus determines what data can be queried via the API. Likewise, the result sets of the queries below the entry point are also accessible through the end point, so that data on multiple 1:n relationships can also be retrieved from the database.

Prerequisites

In order for the Web API to be accessible, the Web Viewer has to be published. If the Web Viewer was already published in a version that did not include the Web API functionality, it may be necessary to republish the Web Viewer. However, this is also checked when enable a Web API endpoint.

Only users who have the LOGINventory permission level Administrator can create or edit endpoints.

Warning

Currently, the Web API functionality is only available in beta mode. To enable the beta mode of LOGINventory, follow these instructions!

Activate a Web API Endpoint

Web API endpoints can be positioned on all queries in the tree structure. The result set of the query determines which data is accessible via the endpoint.

To set up the endpoint on a query, the ribbon menu Node Properties can be used to navigate to the tab Web API Endpoint.

This menu then provides options to enable the endpoint, assign a unique name, and optionally specify a filter path.

The assigned name is then also found in the Web API URL under which the data can be retrieved. The URL can be copied to the clipboard by clicking the corresponding button.

Info

Optionally, there is also the possibility to create a URL in this dialog with the help of the Filter Pattern Generator, which contains a filter. A filter condition can be created which is then "translated" into the URL. This function can be useful to connect third party systems that should not retrieve the complete result set, but e.g. only the data for a specific device.However, the Filter Pattern Generator does not have to be used to create a filtered URL. If you are familiar with the syntax, you can likewise add filters to the URL when retrieving the data, without first creating them in the generator.

Definition of the Data Structure

As mentioned at the beginning, the data available through the Web API endpoint is the data contained in the result set of the query. This means that both the column selection of the query, and filter conditions defined in the Query Editor are respected.

Info

User defined layout customizations, like column orders, hiding columns or filters in the data view, have no influence on the data available via the endpoint.

If there are other queries below the query on which the endpoint was set up, then the result sets of those queries are also available through the endpoint. In this way, several 1:n relationships to the base table of the query can also be retrieved via the endpoint, e.g. for a device both device detail (1:1 relationship) and information about the software packages present there (1:n relationship) and the installed memory modules (1:n relationship).

Important

Below Device queries only queries whose base table has a direct navigation to the Device entity can be used. These are mostly queries whose base table ends with Info, e.g. SoftwarePackageInfo or MemoryModuleInfo. All queries that are located in the tree structure below Software, Hardware or Configuration in the subfolder "Query Lists" meet this criterion. Therefore, if necessary, these queries can be copied under the query node with the endpoint. Other queries to which there is no direct navigation, e.g. with base table SoftwarePackage can be inserted in the tree structure below a node with endpoint, but a JSON export is not possible. Whether the export works can be tested in LOGINventory by selecting the option Json Export in the ribbon menu Quick Export on the node with the endpoint and the export runs through without error message.

Overview of Enabled Endpoints

All enabled endpoints are listed below the Web API Endpoints node. From here it is also possible to edit the endpoints or deactivate them again if no access should be possible through them anymore.

Access to Web API Endpoints

Using HTTP GET requests, data can be retrieved from an enabled Web API endpoint. For example, the response in JSON format looks like the following:

[
    {
        "DeviceInfo": {
            "ChassisType": "Rack Mount Chassis"
        },
        "LastInventory": {
            "Ip": "192.168.200.26",
            "Timestamp": "2022-06-02T10:56:28.763"
        },
        "Name": "DEKAN",
        "Software-Pakete": [
            {
                "Name": "HP Officejet Pro 8620 Basic Device Software",
                "Version": "32.3.198.49673"
            },
            {
                "Name": "HP Officejet Pro 8620 Help",
                "Version": "32.0.0"
            }
        ],
        "RAM-Module": [
            {
                "Name": "PROC 1 DIMM 2A",
                "SerialNumber": "61FF05E6",
                "Size": 16384,
                "Speed": "1333"
            },
            {
                "Name": "PROC 1 DIMM 1D",
                "SerialNumber": "CC176230",
                "Size": 2048,
                "Speed": "1333"
            }
        ]
    },
...

Testing the Connection Using a Web Browser

Using a web browser, the corresponding endpoint URL can also be accessed if the user used (or the user logged in in the case of Windows authentication) is authorized to do so.

Authentication

Warning

After publishing the web viewer, only "ASP.NET Identity Switching" and "Windows Authentication" are enabled by default. If the client you are using does not support Windows authentication, you may still need to enable "Basic Authentication" in the IIS settings (running inetmgr) for the LOGINventory page.

Access to the Web API can be authorized using standard authentication (Basic Authentication) - i.e. user name and password - or integrated Windows authentication. The used user must be authorized on the query in LOGINventory itself (= the query must be shared with the user), so that the data can be retrieved.

Info

If no roles have been assigned in LOGINventory, any user can access all data in LOGINventory and thus retrieve data via a Web API endpoint.

A user who is not authorized to access the corresponding query will not be able to retrieve data via the endpoint and receives an error message.

To allow connection without username and password, Anonymous authentication can be enabled in the IIS settings (running inetmgr).

Application Scenarios

Mass Export to Other Systems

In order to use data from LOGINventory in a third-party system (e.g. a CMDB for modeling dependencies between systems), various export mechanisms are available. Compared to the csv export, the export via Web API endpoint offers the possibility to export several 1:n relationships in one data set, so that e.g. the data for all installed software packages, connected monitors and partition assignments can also be queried for a device. Furthermore, not only a schedule-controlled push of the data, but also a pull of the data is possible. To prepare such an export, you can proceeded e.g. as follows:

  1. a new query structure is defined in LOGINventory that contains exactly the columns that are to be exported to the third party system. If several 1:n relationships to a device are to be exported, corresponding queries are created below the first query (see Definition of the data structure).
  2. a new Web API endpoint is set up on the new query via the Node Properties.
  3. the third party system imports the data periodically via HTTP GET request, updating the internal dataset as needed.

Live Connection of Individual Datasets

In order to retrieve additional information from the inventory in a third-party system (e.g. a helpdesk), which also displays data on computers like LOGINventory, it is suitable to connect both systmes using HTTP requests. This can be done e.g. as follows:

  1. a new query is defined in LOGINventory that contains exactly the columns that should be displayed in the third party system, e.g. name of the device (Device.Name), operating system (OperatingSystem.Name), IP address (LastInventory.IP), location (Custom property Custom.Location) and date of last boot (OperatingSystem.LastBoot). No filtering is needed in the query itself.
  2. a new Web API endpoint is set up on this query via the Node properties.
  3. in the helpdesk the name of the affected device is already known; the other values should be dynamically queried "live" from LOGINventory. This means that the results of all devices should not be queried, but only those of a specific device. For this purpose, the Filter Pattern Generator can be used to generate a URL that filters on a specific device (e.g. Device.Name = PC123). The generated URL can be used by the third party system to retrieve the data of the device 'PC123'.
  4. to retrieve the data of another device the text 'PC123' in the URL must be replaced by the name of the respective device.

Direct Connection to Other Systems

Does your company use software that should be connected in a similar way as described here? Feel free to contact the manufacturer of the software and establish the contact to us. We are ready to support you with the connection.

Zurück zum Seitenanfang