Create device groups

This endpoint is used to create a device group.

Leave Feedback

URL

POST https://{api-url}/api/v2/tenants/{tenantId}/deviceGroups

Sample URLs

https://{api-url}/api/v2/tenants/client_10/deviceGroups

Parameters

FieldData TypeDescription
nameStringUnique name for the device group. The device group is identified with this name.
entityTypeStringType of resources in a group. Example: DEVICE_GROUP, SNS
filterCriteria(Optional) Set of rules to filter resources.
matchTypeString(Optional) The type of match:
  • To match all the filter conditions, provide matchType: ALL.
  • To match any one of the filter conditions, provide matchType: ANY.
rules
  • key
  • operator
  • resource type
  • value
String(Optional) Filter devices with specific attributes:
  • Attribute name of device. Example: Name, Operating System. Attribute names change with device types.
  • Matching parameter. Supported operators are: Equals, Contains, Not Contains, Starts with, Ends with, Regex. Learn more about Regex.
  • Type of resource
kbArticleIdsInteger(Optional) Assign knowledge base articles to a device group. To fetch a knowledge base article ID:
  1. Log into OpsRamp.
  2. Click Knowledge Base.
  3. Select the required article and then copy the article ID without #.
  4. Provide the article ID in kbArticleIds field.Example: "kbArticleIds": [22089]

Status code

200 OK

Sample request

[{
		"name": "Storage Device Group",
		"entityType": "DEVICE_GROUP",
		"kbArticlesIds": [10897]
	},
	{
		"name": "Warehouse Device Group",
		"entityType": "DEVICE_GROUP",
		"filterCriteria": {
			"matchType": "ANY",
			"rules": [{
					"key": "Name",
					"operator": "Contains",
					"value": "Switch",
					"resourceType": "DEVICE"
				},
				{
					"key": "Topic Name",
					"operator": "Contains",
					"value": "sns",
					"resourceType": "SNS"
				}
			]
		}
	}

Sample response

[
    {
        "id": "DGP-a20e13ad-e98f-416e-a9dd-40158ffdb2af",
        "name": "Storage Device Group",
        "createdDate": "2017-08-10T07:28:47+0000",
        "updatedDate": "2017-08-10T07:28:47+0000",
        "entityType": "DEVICE_GROUP",
		"kbArticlesIds" : [10897]
    },
    {
	    "id": "DGP-0cd9cf8e-bb6b-42ac-b438-1c005679f543",
	    "name": "Warehouse Device Group",
	    "createdDate": "2017-11-14T06:20:09+0000",
	    "updatedDate": "2017-11-14T06:20:09+0000",
	    "entityType": "DEVICE_GROUP",
	    "filterCriteria": {
	        "matchType": "ANY",
	        "rules": [
	            {
	                "key": "Name",
	                "operator": "Contains",
	                "value": "Switch",
	                "resourceType": "DEVICE"
	            },
	            {
	                "key": "Topic Name",
	                "operator": "Contains",
	                "value": "sns",
	                "resourceType": "SNS"
	            }
	        ]
	    }
	}
]