Contexts

List Contexts

get/contexts

Lists all contexts.

Related SDK Methods:
Java

ContextsApi.listContexts([param1, param2, ...])

Python

ContextsApi.list_contexts([param1, param2, ...])

JavaScript

ContextsApi.listContexts([param1, param2, ...])

Request
header Parameters
api-version
required
string

The version of the api being called.

Example: YOUR VERSION
Responses
200

successful operation

403

Not authorized to view contexts.

Request samples
import com.trendmicro.deepsecurity.ApiClient;
import com.trendmicro.deepsecurity.Configuration;
import com.trendmicro.deepsecurity.auth.ApiKeyAuth;
import com.trendmicro.deepsecurity.ApiException;
import com.trendmicro.deepsecurity.api.ContextsApi;
import com.trendmicro.deepsecurity.model.Contexts;


public class ListContextsExample {
	
	public static void main(String[] args) {
		// Setup
		ApiClient defaultClient = Configuration.getDefaultApiClient();
		defaultClient.setBasePath("YOUR HOST");

		// Authentication
		ApiKeyAuth DefaultAuthentication = (ApiKeyAuth) defaultClient.getAuthentication("DefaultAuthentication");
		DefaultAuthentication.setApiKey("YOUR API KEY");
		try {
			defaultClient.trustAllCertificates(false);
		} catch (Exception e) {
			System.err.println("An exception occurred when calling ApiClient.trustAllCertificates");
			e.printStackTrace();
		}
		
		// Initialization
		// Set Any Required Values
		ContextsApi instance = new ContextsApi();
		String apiVersion = "YOUR VERSION";
		try {
			// Please replace the parameter values with yours
			Contexts result = instance.listContexts(apiVersion);
			System.out.println(result);
		} catch (ApiException e) {
			System.err.println("An exception occurred when calling ContextsApi.listContexts");
			e.printStackTrace();
		}
	}
}

Response samples
application/json
{
  • "contexts": [
    ]
}

Create a Context

post/contexts

Create a new context.

Related SDK Methods:
Java

ContextsApi.createContext([param1, param2, ...])

Python

ContextsApi.create_context([param1, param2, ...])

JavaScript

ContextsApi.createContext([param1, param2, ...])

Request
header Parameters
api-version
required
string

The version of the api being called.

Example: YOUR VERSION
Request Body schema: application/json

The settings of the new context.

description
string

Description of the context. Searchable as String.

localConnectionsEnabled
boolean

Specifies whether the context applies to connections that are locally conntected to a domain. Set to true to apply to locally connected.

minimumAgentVersion
string

Minimum supported agent version.

name
string

Name of the context. Searchable as String.

noConnectionEnabled
boolean

Specifies whether the context applies to connections that are no connection enabled. Set to true to apply to no connection enabled.

noInternetEnabled
boolean

Specifies whether the context applies to connections that are neither connection nor Internet enabled. Set to true to apply.

remoteConnectionsEnabled
boolean

Specifies whether the context applies to connections that are remotely conntected to a domain. Set to true to apply to remotely connected.

restrictedInterfacesEnabled
boolean

Controls if the firewall contents are restricted from view and duplication. Set to true if it's restricted. Searchable as Boolean.

Responses
200

successful operation

403

Not authorized to create contexts.

Request samples
application/json
{
  • "name": "string",
  • "description": "string",
  • "minimumAgentVersion": "string",
  • "localConnectionsEnabled": true,
  • "remoteConnectionsEnabled": true,
  • "noConnectionEnabled": true,
  • "noInternetEnabled": true,
  • "restrictedInterfacesEnabled": true
}
Response samples
application/json
{
  • "name": "string",
  • "description": "string",
  • "minimumAgentVersion": "string",
  • "localConnectionsEnabled": true,
  • "remoteConnectionsEnabled": true,
  • "noConnectionEnabled": true,
  • "noInternetEnabled": true,
  • "restrictedInterfacesEnabled": true,
  • "ID": 0
}

Search Contexts

post/contexts/search

Search for contexts using optional filters.

Related SDK Methods:
Java

ContextsApi.searchContexts([param1, param2, ...])

Python

ContextsApi.search_contexts([param1, param2, ...])

JavaScript

ContextsApi.searchContexts([param1, param2, ...])

Request
header Parameters
api-version
required
string

The version of the api being called.

Example: YOUR VERSION
Request Body schema: application/json

A collection of options used to filter the search results.

maxItems
integer <int32>

Limits the number of objects returned. Default 5000.

Array of objects (searchCriteria)

Array of search critiera used to filter objects. Searching with multiple criteria returns results that satisfy all of the criteria. Searching with no criteria returns all objects.

sortByObjectID
boolean

If true, forces the response objects to be sorted by ID, overriding the default sort order. Default "false".

Responses
200

successful operation

403

Not authorized to view contexts.

Request samples
application/json
{
  • "maxItems": 0,
  • "searchCriteria": [
    ],
  • "sortByObjectID": true
}
Response samples
application/json
{
  • "contexts": [
    ]
}

Describe a Context

get/contexts/{contextID}

Describe a context by ID.

Related SDK Methods:
Java

ContextsApi.describeContext([param1, param2, ...])

Python

ContextsApi.describe_context([param1, param2, ...])

JavaScript

ContextsApi.describeContext([param1, param2, ...])

Request
path Parameters
contextID
required
integer <int32> \d+

The ID number of the context to describe.

Example: 1
header Parameters
api-version
required
string

The version of the api being called.

Example: YOUR VERSION
Responses
200

successful operation

403

Not authorized to view contexts.

404

The context does not exist.

Request samples
import com.trendmicro.deepsecurity.ApiClient;
import com.trendmicro.deepsecurity.Configuration;
import com.trendmicro.deepsecurity.auth.ApiKeyAuth;
import com.trendmicro.deepsecurity.ApiException;
import com.trendmicro.deepsecurity.api.ContextsApi;
import com.trendmicro.deepsecurity.model.Context;


public class DescribeContextExample {
	
	public static void main(String[] args) {
		// Setup
		ApiClient defaultClient = Configuration.getDefaultApiClient();
		defaultClient.setBasePath("YOUR HOST");

		// Authentication
		ApiKeyAuth DefaultAuthentication = (ApiKeyAuth) defaultClient.getAuthentication("DefaultAuthentication");
		DefaultAuthentication.setApiKey("YOUR API KEY");
		try {
			defaultClient.trustAllCertificates(false);
		} catch (Exception e) {
			System.err.println("An exception occurred when calling ApiClient.trustAllCertificates");
			e.printStackTrace();
		}
		
		// Initialization
		// Set Any Required Values
		ContextsApi instance = new ContextsApi();
		Integer contextID = 1;
		String apiVersion = "YOUR VERSION";
		try {
			// Please replace the parameter values with yours
			Context result = instance.describeContext(contextID, apiVersion);
			System.out.println(result);
		} catch (ApiException e) {
			System.err.println("An exception occurred when calling ContextsApi.describeContext");
			e.printStackTrace();
		}
	}
}

Response samples
application/json
{
  • "name": "string",
  • "description": "string",
  • "minimumAgentVersion": "string",
  • "localConnectionsEnabled": true,
  • "remoteConnectionsEnabled": true,
  • "noConnectionEnabled": true,
  • "noInternetEnabled": true,
  • "restrictedInterfacesEnabled": true,
  • "ID": 0
}

Modify a Context

post/contexts/{contextID}

Modify a context by ID. Any unset elements will be left unchanged.

Related SDK Methods:
Java

ContextsApi.modifyContext([param1, param2, ...])

Python

ContextsApi.modify_context([param1, param2, ...])

JavaScript

ContextsApi.modifyContext([param1, param2, ...])

Request
path Parameters
contextID
required
integer <int32> \d+

The ID number of the context to modify.

Example: 1
header Parameters
api-version
required
string

The version of the api being called.

Example: YOUR VERSION
Request Body schema: application/json

The settings of the context to modify.

description
string

Description of the context. Searchable as String.

localConnectionsEnabled
boolean

Specifies whether the context applies to connections that are locally conntected to a domain. Set to true to apply to locally connected.

minimumAgentVersion
string

Minimum supported agent version.

name
string

Name of the context. Searchable as String.

noConnectionEnabled
boolean

Specifies whether the context applies to connections that are no connection enabled. Set to true to apply to no connection enabled.

noInternetEnabled
boolean

Specifies whether the context applies to connections that are neither connection nor Internet enabled. Set to true to apply.

remoteConnectionsEnabled
boolean

Specifies whether the context applies to connections that are remotely conntected to a domain. Set to true to apply to remotely connected.

restrictedInterfacesEnabled
boolean

Controls if the firewall contents are restricted from view and duplication. Set to true if it's restricted. Searchable as Boolean.

Responses
200

successful operation

403

Not authorized to modify contexts or the requested modification is not permitted.

404

The context does not exist.

Request samples
application/json
{
  • "name": "string",
  • "description": "string",
  • "minimumAgentVersion": "string",
  • "localConnectionsEnabled": true,
  • "remoteConnectionsEnabled": true,
  • "noConnectionEnabled": true,
  • "noInternetEnabled": true,
  • "restrictedInterfacesEnabled": true
}
Response samples
application/json
{
  • "name": "string",
  • "description": "string",
  • "minimumAgentVersion": "string",
  • "localConnectionsEnabled": true,
  • "remoteConnectionsEnabled": true,
  • "noConnectionEnabled": true,
  • "noInternetEnabled": true,
  • "restrictedInterfacesEnabled": true,
  • "ID": 0
}

Delete a Context

delete/contexts/{contextID}

Delete a context by ID.

Related SDK Methods:
Java

ContextsApi.deleteContext([param1, param2, ...])

Python

ContextsApi.delete_context([param1, param2, ...])

JavaScript

ContextsApi.deleteContext([param1, param2, ...])

Request
path Parameters
contextID
required
integer <int32> \d+

The ID number of the context to delete.

Example: 1
header Parameters
api-version
required
string

The version of the api being called.

Example: YOUR VERSION
Responses
200

Request is successful.

403

Not authorized to delete contexts.

Request samples
import com.trendmicro.deepsecurity.ApiClient;
import com.trendmicro.deepsecurity.Configuration;
import com.trendmicro.deepsecurity.auth.ApiKeyAuth;
import com.trendmicro.deepsecurity.ApiException;
import com.trendmicro.deepsecurity.api.ContextsApi;


public class DeleteContextExample {
	
	public static void main(String[] args) {
		// Setup
		ApiClient defaultClient = Configuration.getDefaultApiClient();
		defaultClient.setBasePath("YOUR HOST");

		// Authentication
		ApiKeyAuth DefaultAuthentication = (ApiKeyAuth) defaultClient.getAuthentication("DefaultAuthentication");
		DefaultAuthentication.setApiKey("YOUR API KEY");
		try {
			defaultClient.trustAllCertificates(false);
		} catch (Exception e) {
			System.err.println("An exception occurred when calling ApiClient.trustAllCertificates");
			e.printStackTrace();
		}
		
		// Initialization
		// Set Any Required Values
		ContextsApi instance = new ContextsApi();
		Integer contextID = 1;
		String apiVersion = "YOUR VERSION";
		try {
			// Please replace the parameter values with yours
			instance.deleteContext(contextID, apiVersion);
		} catch (ApiException e) {
			System.err.println("An exception occurred when calling ContextsApi.deleteContext");
			e.printStackTrace();
		}
	}
}