Documentation is now available for the Fall 2020 Update release!

Search resources

This endpoint is used to retrieve the resources of a partner or a client.

Leave Feedback

URL

GET https://{api-url}/api/v2/tenants/{tenantId}/resources/search

Sample URLs

To retrieve all resources of the client:

https://{api-url}/api/v2/tenants/client_16/resources/search

To retrieve specific resources using query variables:

https://{api-url}/api/v2/tenants/msp_1/resources/search?pageNo=1&pageSize=3&queryString=agentInstalled:true%2Bstate:inactive

For this sample, the agent is installed and resources are in inactive state.

Special characters in query string

There are special characters that can be used in a query string:

  • (+) represents the next field and must be URL-encoded. URL encoded is %2B.
  • (:) represents equals. An example is key : value.
  • Space characters must be URL-encoded.
  • Date format must be yyyy-MM-ddTHH:mm:ssZ (GMT).

Valid input values for query string

The following example show valid input values:

  • State values are enum: active/inactive
    "queryString=state:active"
    "queryString=state:inactive"
    
  • Allow only listed variables
    "queryString=hostName:abc" //valid
    "queryString=hostName2:abc" //Invalid
    
  • Provide both variable name and value
    "queryString=hostName:abc" //valid
    "queryString=hostName" //Invalid
    

Parameters

All parameters are optional:

FieldDefault Value
pageNo={pageNo}1
pageSize={pageSize}100
isDescendingOrder={true/false}true
sortName={field}id
queryString={queryString}NA
includeStatus={true/false}false

NA indicates that the value is not applicable.

Query variables

Query VariablesDescription
hostName/resourceNameName of the host.
dnsNameDomain service name.
aliasNameOther name of resource.
idResource unique ID.
Example: d5bce6fe-d19f-4ad7-8c50-5f639f2dd321
serialNumberResource serial number.
ipAddressResource IP address.
systemUIDSystem unique ID.
stateResource state.
Supported values: active, inactive, discovered
typeResource type. Learn more about the supported resource types.
Example: DEVICE, SQL_SERVER
resourceTypeFilter resources based on a resource type. Use `Get Device Types API` to fetch resource types supported by OpsRamp. Provide multiple resource types with comma-separated strings.
Example: DEVICE, DOCUMENT_DB
deviceTypeFilter resources based on device type. This parameter is required if the resource type is a device. Use `Get Device Types API` to retrieve the names of supported device types. Enumerate multiple device type names with comma-separated strings.
Example: Windows, Linux
appRolesFilter for applications running on the resources. List of supported applications:
activemqhbasemongodbrabbitmq
apachehdfs-datanodemonitdMemoryStatsredis
cassandrahdfs-namenodemoxi-serverriak
cephiptablemysqlsolr
couchbasejbossnfsiostatspark
couchdbkafkanginxsquid
DNS-Serverkubernetesntptomcat
dockerkvmopenvpnvarnish
docker-containerlighttpdoracleweblogic
elasticsearchmesosmasterpostfixwebsphere
haproxymesosslavepostgresqlzookeeper
startCreationDateIndicates the date to search the creation date of a resource. Start indicates from date.
Example: 2018-01-12T04:53:53 0000
endCreationDateIndicates the date to search for the last date of resource creation. End indicates to date.
Example: 2018-02-10T10:20:25 0000
startUpdationDateSearch for a resource updated within a specific duration. Start indicates from date.
Example: 2018-01-12T04:53:53 0000
endUpdationDateSearch for a resource updated within a specific duration. End indicates to date.
Example: 2018-02-10T10:20:25 0000
tagsAdditional details about a resource. Enumerate provide multiple tags separated by a comma.
Example: parentDevice, category
templateMonitoring template assigned to a resource. Provide the monitoring template ID to fetch the list of resources attached to a monitoring template.
agentProfileSearch for resources with agent profile ID. Retrieve resources that belong to a particular agent.
gatewayProfileSearch for resources with Gateway profile ID. Fetch resources that belong to a particular gateway.
instanceIdCloud instance ID.
accountNumberAccount number of public or private clouds.
installedIntgIdInstalled integration ID. Search Installed Integrations retrieves the list of integrations installed. Provide the integration ID to fetch the resources associated with an integration.
agentInstalledFilter for resources with agent installed:
  • agentInstalled: true to fetch agent installed resources:
  • agentInstalled: false to fetch non-agent resources.
deviceGroupFetch resources that belong to specific device group. Provide a device group name.
Example: Windows Servers
serviceGroupFetch resources that belong to a specific service group by providing the service group name.
Example: Admin Group
deviceLocationFetch resources that are at a specific location. Provide a location name.
Example: West-SJ
isEqualsParameter to consider the exact match for a variable:
  • isEquals: true, to consider the exact match of a variable.
  • isEquals: false to consider a similar match of a variable.
    For example, to fetch list of resources in location West Valley, provide the query variable as deviceLocation: West Valley+isEquals: true.
firstAssetManagedTimeThe first time a resource is managed.
assetManagedTimeThe most recent time a resource is managed. The asset managed time gets updated whenever a resource is managed or unmanaged.
aliasIpAlias IP address of the network you have.

Sample response

{
    "results": [
        {
            "id": "61fec02a-4370-4dfb-be4d-1bb9fe3e05aa",
            "hostName": "TestHost",
            "ipAddress": "1.1.1.2",
            "dns": "",
            "client": {
                "id": 4,
                "uniqueId": "client_4",
                "name": "EHR"
            },
            "createdDate": "2019-05-20T09:31:50+0000",
            "classCode": "device",
            "deviceType": "Desktop",
            "devicePath": "Desktop",
            "type": "DEVICE",
            "state": "active",
            "make": "",
            "model": "",
            "osName": "",
            "description": "test dummy device",
            "gatewayProfileId": "0",
            "source": "MANUAL",
            "agentInstalled": false,
            "attributes": {
                "network": [
			{
                        "ip": "172.24.133.91",
                        "mac": "f8:94:c2:0c:10:f2",
                        "aliasIp": "172.24.133.100, 172.24.133.101"
                    }
		]
            },
            "aliasName": "TestAlias",
            "name": "TestHost",
            "resourceName": "TestResource",
            "consoles": [],
            "resourceType": "Desktop",
            "assetManagedTime": "2019-05-20T09:31:50+0000",
            "firstAssetManagedTime": "2019-05-20T09:31:50+0000",
            "deleted": false,
            "ts": 0,
            "clientId": 0,
            "locationOffset": 0,
            "totalLocations": 0,
        }
    ],
    "totalResults": 1,
    "orderBy": "name",
    "pageNo": 1,
    "pageSize": 100,
    "totalPages": 1,
    "nextPage": false,
    "descendingOrder": false
}