Skip to main content
Skip table of contents

Examples

This chapter includes examples of the Lucidum query-based APIs.

Retrieve All Values from the Lucidum Database

We could use the following cURL request to retrieve all values from the database table that contains asset data from current time period. This request is helpful to determine which fields are available. After you know which fields are available, you can use the outputFields parameter and the filter parameters to build more granular requests.

JSON
curl -X 'POST' \
 'https://demo.lucidum.cloud/CMDB/v1/data/cmdb' \
  -H 'accept: */*' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer ******************************"
  
  -d '{
  "collectionName": "AWS_CMDB_Output",
  "page": {
     "currentPage": 1,
     "itemPerPage": 25
  }
}
  • curl -X ‘POST. Use the POST method instead of the default GET method.

  • https://demo.lucidum.cloud/CMDB/v1/data/cmdb. The URL and endpoint for the API request.

  • -H ‘accept: */*'. This argument includes data in the header of the request. The argument tells cURL to accept all media types for a return.

  • -H ‘Content-Type: application/json’. This argument adds data to the header of the request. This argument specifies that the request body will be in JSON format. Lucidum recommends you use this format.

  • -H "Authorization: Bearer ******************************. This argument adds data to the header of the request. This argument specifies that authorization will be via the bearer token we retrieved earlier.

  • “collectionName” : ”AWS_CMDB_Output”. The Lucidum database table to query. This example retrieves data from the database table AWS_CMDB_Output. This is the database table that contains asset data from current time period.

  • Because we did not specify a value for outputFields, this example retrieves all fields for each record.

  • Because we did not specify a filter, this example retrieves all records in the database table.

  • “page”. The page values specify that we want values from the first page of results, with 25 results per page.

The response included response included over 12,000 lines. Here are the first 50 lines of the response:

CODE
{
    "code": 200,
    "data": [
        {
            "_id": "63bd2101edb9b2f330ae5695",
            "_time": 1673339052,
            "run_time": 1673339052,
            "Asset_Name": "#MODEL: ADVANCED\n#SESSIONS: 512000 SESSIONS\n#CAPACITY: UNLIMITED",
            "Is_Public": null,
            "Last_Discovered_Datetime": 1673338111,
            "app": null,
            "Asset_Groups": null,
            "Open_Port_List": [
                "135",
                "3389",
                "445",
                "49154",
                "49155"
            ],
            "VM_ID": null,
            "Data_Store_ID": null,
            "Vuln_Name": null,
            "Services": [
                "loc-srv",
                "microsoft-ds",
                "ms-term-serv"
            ],
            "Host_ID": null,
            "EXT_IP_Address": null,
            "Source_User_Name": null,
            "Vuln_List": null,
            "Tag": null,
            "sourcetype": [
                "sciencelogic_device"
            ],
            "FQDN": null,
            "High_CVE": null,
            "MAC_Address": [
                "00:10:db:89:48:80",
                "00:10:db:89:48:87",
                "00:10:db:89:48:88",
                "00:10:db:89:48:9d",
                "00:10:db:89:48:9e",
                "00:10:db:89:48:9f",
                "00:10:db:89:48:a0",
                "00:10:db:89:48:a1",
                "00:10:db:89:48:a2",
                "00:10:db:89:48:a3"
            ],          

Retrieve Specified Fields from All Assets

We could use the following cURL request to retrieve only some fields from all records in the database table that contains asset data from current time period. This request is helpful to determine which assets are available.

JSON
curl -X 'POST' \
 'https://demo.lucidum.cloud/CMDB/v1/data/cmdb' \
  -H 'accept: */*' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJrYXRlZ2lic29uIiwiYXV0aCI6IkFkbWluIiwibmJmIjoxNjcxMTI1ODU0LCJpYXQiOjE2NzExMjU4NTQsImV4cCI6MTY3MzcxNzg1NH0.mE-32XFFaZmS6DfOkqFtPLVKpA43aYvzmD-9R0fbTLFj0KBNgyKQKTZdr6YKacDl4_AgtEZ97pv3_O1dg7nfgQ"
  
  -d '{
  "collectionName": "AWS_CMDB_Output",
  "outputFields": ["sourcetype", "IP_Address", "OS"],
  "page": {
     "currentPage": 1,
     "itemPerPage": 25
  }
}
  • curl -X ‘POST. Use the POST method instead of the default GET method.

  • https://demo.lucidum.cloud/CMDB/v1/data/cmdb. The URL and endpoint for the API request.

  • -H ‘accept: */*'. This argument includes data in the header of the request. The argument tells cURL to accept all media types for a return.

  • -H ‘Content-Type: application/json’. This argument adds data to the header of the request. This argument specifies that the request body will be in JSON format. Lucidum recommends you use this format.

  • -H "Authorization: Bearer ******************************. This argument adds data to the header of the request. This argument specifies that authorization will be via the bearer token we retrieved earlier.

  • “collectionName” : ”AWS_CMDB_Output”. The Lucidum database table to query. This example retrieves data from the database table AWS_CMDB_Output. This is the database table that contains asset data from current time period.

  • “outputFields”:. outputFields specifies the fields to include for each records in the API response. In this example, we specified sourcetype, IP address, and operating system.

  • Because we did not specify a filter, the request will return the unique ID, sourcetype, IP address, and operating system for all records in the database table.

  • “page”. The page values specify that we want values from the first page of results, with 25 records per page.

The response included over 300 lines. Here are the first 20 lines of the response:

CODE
{
    "code": 200,
    "data": [
        {
            "_id": "63bd2101edb9b2f330ae5695",
            "sourcetype": [
                "sciencelogic_device"
            ],
            "IP_Address": [
                "172.16.0.171"
            ],
            "OS": "OEM"
        },
        {
            "_id": "63bd2101edb9b2f330ae5696",
            "sourcetype": [
                "sciencelogic_device"
            ],
            "IP_Address": null,
            "OS": "DOCKER CONTAINER"
        },

Retrieve All Fields from Specified Assets

We could use the following cURL request to retrieve all values from only specific records in the database table that contains asset data from current time period. This request is helpful to determine which fields are available. After you know which fields are available, you can use the outputFields parameter and filter parameters to build more granular requests.

JSON
curl -X 'POST' \
 'https://demo.lucidum.cloud/CMDB/v1/data/cmdb' \
  -H 'accept: */*' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJrYXRlZ2lic29uIiwiYXV0aCI6IkFkbWluIiwibmJmIjoxNjcxMTI1ODU0LCJpYXQiOjE2NzExMjU4NTQsImV4cCI6MTY3MzcxNzg1NH0.mE-32XFFaZmS6DfOkqFtPLVKpA43aYvzmD-9R0fbTLFj0KBNgyKQKTZdr6YKacDl4_AgtEZ97pv3_O1dg7nfgQ"
  
  -d '{
  "collectionName": "AWS_CMDB_Output",
  "filter": [
      {
          "field": "Vendor",
          "operator": "=",
          "value": "Dell"
      },
      {   
          "field": "OS",
          "operator": "=",
          "value": "WINDOWS"
      }
    ],
  "page": {
     "currentPage": 1,
     "itemPerPage": 25
  }
}
  • curl -X ‘POST. Use the POST method instead of the default GET method.

  • https://demo.lucidum.cloud/CMDB/v1/data/cmdb. The URL and endpoint for the API request.

  • -H ‘accept: */*'. This argument includes data in the header of the request. The argument tells cURL to accept all media types for a return.

  • -H ‘Content-Type: application/json’. This argument adds data to the header of the request. This argument specifies that the request body will be in JSON format. Lucidum recommends you use this format.

  • -H "Authorization: Bearer ******************************. This argument adds data to the header of the request. This argument specifies that authorization will be via the bearer token we retrieved earlier.

  • “collectionName” : ”AWS_CMDB_Output”. The Lucidum database table to query. This example retrieves data from the database table AWS_CMDB_Output. This is the database table that contains asset data from current time period.

  • Because we did not specify a value for outputField, this example retrieves all fields for each record in the response.

  • “filter”. We specified two filters. We are interested only in assets where the Vendor is Dell AND where the operating system is Windows. The results will include only asset records that match both those filters.

  • “page”. The page values specify that we want values from the first page of results, with 25 records per page.

The results include over 41000 lines. Each record is around 800 lines. Here are the first 25 lines of the response:

CODE
{
    "code": 200,
    "data": [
        {
            "_id": "63be727a111a9a0b086076ca",
            "_time": 1673425445,
            "run_time": 1673425445,
            "Asset_Name": "10CLVD2",
            "Is_Public": null,
            "Last_Discovered_Datetime": 1673420922,
            "Source_User_Name": [
                "BZIEGLER",
                "BZIEGLER@LUCIDUM.IO",
                "Barbara Ziegler"
            ],
            "IP_Address": [
                "10.20.236.93",
                "10.224.213.20",
                "10.98.252.240",
                "192.168.97.186",
                "64.32.197.242"
            ],
            "Services": null,
            "Critical_Risk_App": null,
            "FQDN": [
                "bziegler-10clvd2.lucidum.io"
            ],

Retrieve All Fields And Exclude Specified Assets

We could use the following cURL request to retrieve all values from from records in the database table that contains asset data from current time period. However, we will exlcude specific records.

JSON
curl -X 'POST' \
 'https://demo.lucidum.cloud/CMDB/v1/data/cmdb' \
  -H 'accept: */*' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJrYXRlZ2lic29uIiwiYXV0aCI6IkFkbWluIiwibmJmIjoxNjcxMTI1ODU0LCJpYXQiOjE2NzExMjU4NTQsImV4cCI6MTY3MzcxNzg1NH0.mE-32XFFaZmS6DfOkqFtPLVKpA43aYvzmD-9R0fbTLFj0KBNgyKQKTZdr6YKacDl4_AgtEZ97pv3_O1dg7nfgQ"
  
  -d '{
      "collectionName": "AWS_CMDB_Output",
          "filter": [
      {
         "field": "sourcetype",
         "operator": "not contains",
         "value": ["sciencelogic_device"]
      }
    ],
    "page": {
        "currentPage": 1,
        "itemPerPage": 25
    }
}  
  • curl -X ‘POST. Use the POST method instead of the default GET method.

  • https://demo.lucidum.cloud/CMDB/v1/data/cmdb. The URL and endpoint for the API request.

  • -H ‘accept: */*'. This argument includes data in the header of the request. The argument tells cURL to accept all media types for a return.

  • -H ‘Content-Type: application/json’. This argument adds data to the header of the request. This argument specifies that the request body will be in JSON format. Lucidum recommends you use this format.

  • -H "Authorization: Bearer ******************************. This argument adds data to the header of the request. This argument specifies that authorization will be via the bearer token we retrieved earlier.

  • “collectionName” : ”AWS_CMDB_Output”. The Lucidum database table to query. This example retrieves data from the database table AWS_CMDB_Output. This is the database table that contains asset data from current time period.

  • Because we did not specify a value for outputField, this example retrieves all fields for each record in the response.

  • “filter”. We specified one filter. We are interested only in assets that do not include a sourcetype of “sciencelogic_device”. The results will not include any asset records that match that filter.

  • “page”. The page values specify that we want values from the first page of results, with 25 records per page.

The results include over 41000 lines. Each record is around 800 lines. Here are the first 25 lines of the response:

CODE
{
    "code": 200,
    "data": [
        {
            "_id": "63be727a111a9a0b08607619",
            "_time": 1673425445,
            "run_time": 1673425445,
            "Asset_Name": "0030KH1",
            "Is_Public": null,
            "Last_Discovered_Datetime": 1673421425,
            "Source_User_Name": [
                "RBARR",
                "RBARR@LUCIDUM.IO",
                "Rodrick Barr"
            ],
            "IP_Address": [
                "10.226.211.34",
                "192.168.222.104",
                "192.168.75.222"
            ],
            "Services": null,
            "Critical_Risk_App": null,
            "FQDN": [
                "rbarr-0030kh1.lucidum.io"
            ],
...

Retrieve Specified Fields from Specified Assets

We could use the following cURL request to retrieve specific values from only specific records in the database table that contains asset data from current time period.

JSON
curl -X 'POST' \
 'https://demo.lucidum.cloud/CMDB/v1/data/cmdb' \
  -H 'accept: */*' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJrYXRlZ2lic29uIiwiYXV0aCI6IkFkbWluIiwibmJmIjoxNjcxMTI1ODU0LCJpYXQiOjE2NzExMjU4NTQsImV4cCI6MTY3MzcxNzg1NH0.mE-32XFFaZmS6DfOkqFtPLVKpA43aYvzmD-9R0fbTLFj0KBNgyKQKTZdr6YKacDl4_AgtEZ97pv3_O1dg7nfgQ"
  
  -d '{
  "collectionName": "AWS_CMDB_Output",
  "outputFields": ["sourcetype", "IP_Address", "OS", "Vendor", "Model"],
  "filter": [
        {
            "field": "Vendor",
            "operator": "=",
            "value": "CISCO"
        },
        {   
            "field": "OS",
            "operator": "=",
            "value": "ASA"
        }
    ],
    "page": {
        "currentPage": 1,
        "itemPerPage": 25
    }
}   
  • curl -X ‘POST. Use the POST method instead of the default GET method.

  • https://demo.lucidum.cloud/CMDB/v1/data/cmdb. The URL and endpoint for the API request.

  • -H ‘accept: */*'. This argument includes data in the header of the request. The argument tells cURL to accept all media types for a return.

  • -H ‘Content-Type: application/json’. This argument adds data to the header of the request. This argument specifies that the request body will be in JSON format. Lucidum recommends you use this format.

  • -H "Authorization: Bearer ******************************. This argument adds data to the header of the request. This argument specifies that authorization will be via the bearer token we retrieved earlier.

  • “collectionName” : ”AWS_CMDB_Output”. The Lucidum database table to query. This example retrieves data from the database table AWS_CMDB_Output. This is the database table that contains asset data from current time period.

  • “outputFields”:. outputFields specifies the fields to include for each record in the API response. In this example, we specified sourcetype, IP address, operating system, vendor, and model.

  • “filter”. We specified two filters. We are interested only in assets where the Vendor is Cisco AND where the operating system is ASA. The results will include only assets that match both those filters.

  • “page”. The page values specify that we want values from the first page of results, with 25 records per page.

The results look like this:

CODE
{
    "code": 200,
    "data": [
        {
            "_id": "63be727a111a9a0b08607d0e",
            "IP_Address": [
                "172.16.32.199"
            ],
            "sourcetype": [
                "sciencelogic_device"
            ],
            "Model": null,
            "OS": "ASA5525",
            "Vendor": "CISCO SYSTEMS"
        },
        {
            "_id": "63be727d111a9a0b086085b9",
            "IP_Address": [
                "172.16.32.198"
            ],
            "sourcetype": [
                "sciencelogic_device"
            ],
            "Model": null,
            "OS": "ASA5585-SSP-20",
            "Vendor": "CISCO SYSTEMS"
        }
    ],
    "page": {
        "currentPage": 1,
        "itemPerPage": 50,
        "totalPage": 1,
        "totalCount": 2
    }
}

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.