Decommissioning inactive computers (v2)

9.2.24 Available from 9.2.24.

You use the DELETE operation on the api/sam/v2/computers element to decommission a computer on which the disconnected scanner is installed from the License Metric Tool server.

Permissions

User You must have the Manage Endpoints and View Endpoints permissions to use this API.

Resource URL

https://hostname:port/api/sam/v2/computers

Resource information

Table 1. Resource information
Operation details Description
HTTP method DELETE
Request headers
Accept-Language (optional)
  • Use: Used to negotiate the language of the response. If this header is not specified, the content is returned in the server language.
  • Values: en-US (only English is supported)
Token
  • Use: Used to authenticate REST API requests. The header is required when you set the value of the api_token_in_url_enabled parameter to false. Otherwise, you can specify the token in the request header or in the URL. For more information, see: Authenticating REST API requests.
  • Values: an alphanumeric string that is generated in License Metric Tool
Request format application/json
Response headers
Content-Type
  • Use: Specifies the content type of the response.
  • Values: application/json
Content-Language
  • Use: Specifies the language of the response content. If this header is not specified, the content is returned in the server language.
  • Values: en-US, …
Response format application/json
Response codes

200 – OK

400 – “Bad Request” if a query parameter contains errors or is missing

404 – “Not found” if no computers meet the filtering criteria

409 – “Conflict” if two or more active computers meet the filtering criteria

Action parameters

Table 2. Action parameters
Column Description Required Type
disconnected_endpoint_id Identifier of the disconnected computer as defined in the config/endpoint_id.txt file in the disconnected scanner folder. For computers that do not report to a disconnected data source, the value is null. At least one of these parameters is required String
dns_name DNS of the computer. String
id Identifier of the computer as defined in License Metric Tool. Numeric
ip_address IP address of the computer. String
name Name of the computer. String

Example conversation

Request
DELETE https://hostname:port/api/sam/v2/computers?disconnected_endpoint_id=1
Request header
Accept: application/json 
Accept-Language: en-US
Token: <token>
Response body
200

Example conversation - deleting all computers from which new data has not been sent for more than one month

To delete all computers from which new data has not been sent for more than one month, perform the following steps.
  1. Use the GET operation on the api/sam/v2/computers REST API to retrieve information about all disconnected computers for which the value of the last_seen parameter is older than one month.
    Request
    GET https://hostname:port/api/sam/v2/computers
    ?datasource_type=1&criteria={"and":[["last_seen","ending","-P1M"]]}
    &is_deleted=0&columns[]=id
    Request header
    Accept: application/json 
    Accept-Language: en-US
    Token: <token>
    Response body
    [
    	{
    		"id":1,
    	},
    	{
    		"id":2,
    	},
    ]
    
  2. For every id that is returned by the GET operation, run the DELETE operation.
    Request
    DELETE https://hostname:port/api/sam/v2/computers?id=1
    Request header
    Accept: application/json 
    Accept-Language: en-US
    Token: <token>
    Response body
    200