NAV Navigation
Shell HTTP JavaScript Ruby Python PHP Java Go

XML Policy Management API v1.0

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Please note this API is only available if you have deployed and configured MongoDB with the Glasswall Halo

Authentication

XMLPolicyManagement

Create XML Policy

Code samples

# You can also use wget
curl -X POST /api/v1/xml-policies/{XMLPolicyName} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
POST /api/v1/xml-policies/{XMLPolicyName} HTTP/1.1

Content-Type: application/json
Accept: application/json
const inputBody = '{
"status": "enabled",
"policySettings": {
"EnableWarningHandling": false,
"BlockedTags": [
"/XInclude:include",
"/XSL/Transform:stylesheet"
],
"AllowedEncodings": [
"utf-8",
"utf-16",
"iso-8859-1"
],
"AllowEmptyEncoding": true,
"AllowDoctypeInCData": false
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};

fetch('/api/v1/xml-policies/{XMLPolicyName}',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'

headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}

result = RestClient.post '/api/v1/xml-policies/{XMLPolicyName}',
params: {
}, headers: headers

p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}

r = requests.post('/api/v1/xml-policies/{XMLPolicyName}', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
$response = $client->request('POST','/api/v1/xml-policies/{XMLPolicyName}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}

// ...
URL obj = new URL("/api/v1/xml-policies/{XMLPolicyName}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main

import (
"bytes"
"net/http"
)

func main() {

headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
}

data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "/api/v1/xml-policies/{XMLPolicyName}", data)
req.Header = headers

client := &http.Client{}
resp, err := client.Do(req)
// ...
}

POST /api/v1/xml-policies/{XMLPolicyName}

Creates a named XML Policy with the provided values

Body parameter

{
"status": "enabled",
"policySettings": {
"EnableWarningHandling": false,
"BlockedTags": [
"/XInclude:include",
"/XSL/Transform:stylesheet"
],
"AllowedEncodings": [
"utf-8",
"utf-16",
"iso-8859-1"
],
"AllowEmptyEncoding": true,
"AllowDoctypeInCData": false
}
}

Parameters

Name In Type Required Description
XMLPolicyName path string true The name of the XML Policy to create
body body WritePolicyBody true none

Example responses

201 Response

{
"schemaName": "xmlvalidationv1",
"policyName": "default",
"policyIdentity": "11111111-1111-1111-1111-111111111111",
"policyVersion": 2,
"isDefaultPolicy": true,
"status": "enabled",
"policyLocation": "api/v1/schemas/xmlvalidationv1/policies/policyName"
}

Responses

Status Meaning Description Schema
201 Created XML Policy Created WritePolicyBodyResponse
400 Bad Request XML Policy failed validation, reasons in response None
403 Forbidden Attempt to create ‘default’ XML Policy None
404 Not Found Specified schema not found None
500 Internal Server Error Issues occurred when attempting to access storage. None

Update XML Policy

Code samples

# You can also use wget
curl -X PUT /api/v1/xml-policies/{XMLPolicyName} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
PUT /api/v1/xml-policies/{XMLPolicyName} HTTP/1.1

Content-Type: application/json
Accept: application/json
const inputBody = '{
"status": "enabled",
"policySettings": {
"EnableWarningHandling": false,
"BlockedTags": [
"/XInclude:include",
"/XSL/Transform:stylesheet"
],
"AllowedEncodings": [
"utf-8",
"utf-16",
"iso-8859-1"
],
"AllowEmptyEncoding": true,
"AllowDoctypeInCData": false
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};

fetch('/api/v1/xml-policies/{XMLPolicyName}',
{
method: 'PUT',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'

headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}

result = RestClient.put '/api/v1/xml-policies/{XMLPolicyName}',
params: {
}, headers: headers

p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}

r = requests.put('/api/v1/xml-policies/{XMLPolicyName}', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
$response = $client->request('PUT','/api/v1/xml-policies/{XMLPolicyName}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}

// ...
URL obj = new URL("/api/v1/xml-policies/{XMLPolicyName}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main

import (
"bytes"
"net/http"
)

func main() {

headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
}

data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "/api/v1/xml-policies/{XMLPolicyName}", data)
req.Header = headers

client := &http.Client{}
resp, err := client.Do(req)
// ...
}

PUT /api/v1/xml-policies/{XMLPolicyName}

Updates a named XML Policy with the provided values

Body parameter

{
"status": "enabled",
"policySettings": {
"EnableWarningHandling": false,
"BlockedTags": [
"/XInclude:include",
"/XSL/Transform:stylesheet"
],
"AllowedEncodings": [
"utf-8",
"utf-16",
"iso-8859-1"
],
"AllowEmptyEncoding": true,
"AllowDoctypeInCData": false
}
}

Parameters

Name In Type Required Description
XMLPolicyName path string true The name of the XML Policy to create
body body WritePolicyBody true none

Example responses

200 Response

{
"schemaName": "xmlvalidationv1",
"policyName": "default",
"policyIdentity": "11111111-1111-1111-1111-111111111111",
"policyVersion": 2,
"isDefaultPolicy": true,
"status": "enabled",
"policyLocation": "api/v1/schemas/xmlvalidationv1/policies/policyName"
}

Responses

Status Meaning Description Schema
200 OK XML Policy Updated WritePolicyBodyResponse
400 Bad Request XML Policy failed validation, reasons in response None
404 Not Found Specified schema or XML Policy not found None
500 Internal Server Error Issues occurred when attempting to access storage. None

Get XML Policy

Code samples

# You can also use wget
curl -X GET /api/v1/xml-policies/{XMLPolicyName} \
-H 'Accept: application/json'
GET /api/v1/xml-policies/{XMLPolicyName} HTTP/1.1

Accept: application/json

const headers = {
'Accept':'application/json'
};

fetch('/api/v1/xml-policies/{XMLPolicyName}',
{
method: 'GET',

headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'

headers = {
'Accept' => 'application/json'
}

result = RestClient.get '/api/v1/xml-policies/{XMLPolicyName}',
params: {
}, headers: headers

p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}

r = requests.get('/api/v1/xml-policies/{XMLPolicyName}', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
'Accept' => 'application/json',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
$response = $client->request('GET','/api/v1/xml-policies/{XMLPolicyName}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}

// ...
URL obj = new URL("/api/v1/xml-policies/{XMLPolicyName}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main

import (
"bytes"
"net/http"
)

func main() {

headers := map[string][]string{
"Accept": []string{"application/json"},
}

data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "/api/v1/xml-policies/{XMLPolicyName}", data)
req.Header = headers

client := &http.Client{}
resp, err := client.Do(req)
// ...
}

GET /api/v1/xml-policies/{XMLPolicyName}

Gets a named XML Policy

Parameters

Name In Type Required Description
XMLPolicyName path string true The name of the XML Policy to retrieve the details of

Example responses

200 Response

{
"schemaName": "xmlvalidationv1",
"policyName": "default",
"policyIdentity": "11111111-1111-1111-1111-111111111111",
"policyVersion": 2,
"isDefaultPolicy": true,
"status": "enabled",
"schemaReferences": [],
"policySettings": {
"EnableWarningHandling": false,
"BlockedTags": [
"/XInclude:include",
"/XSL/Transform:stylesheet"
],
"AllowedEncodings": [
"utf-8",
"utf-16",
"iso-8859-1"
],
"AllowEmptyEncoding": true,
"AllowDoctypeInCData": false
}
}

Responses

Status Meaning Description Schema
200 OK XML Policy found Inline
404 Not Found Specified schema or XML Policy not found None
500 Internal Server Error Issues occurred when attempting to access storage. None

Response Schema

Enumerated Values

Property Value
status enabled
status disabled

Delete XML Policy

Code samples

# You can also use wget
curl -X DELETE /api/v1/xml-policies/{XMLPolicyName}
DELETE /api/v1/xml-policies/{XMLPolicyName} HTTP/1.1

fetch('/api/v1/xml-policies/{XMLPolicyName}',
{
method: 'DELETE'

})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'

result = RestClient.delete '/api/v1/xml-policies/{XMLPolicyName}',
params: {
}

p JSON.parse(result)
import requests

r = requests.delete('/api/v1/xml-policies/{XMLPolicyName}')

print(r.json())
<?php

require 'vendor/autoload.php';

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
$response = $client->request('DELETE','/api/v1/xml-policies/{XMLPolicyName}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}

// ...
URL obj = new URL("/api/v1/xml-policies/{XMLPolicyName}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main

import (
"bytes"
"net/http"
)

func main() {

data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "/api/v1/xml-policies/{XMLPolicyName}", data)
req.Header = headers

client := &http.Client{}
resp, err := client.Do(req)
// ...
}

DELETE /api/v1/xml-policies/{XMLPolicyName}

Delete the specified XML Policy

Parameters

Name In Type Required Description
XMLPolicyName path string true The name of the XML Policy to delete

Responses

Status Meaning Description Schema
200 OK OK None
403 Forbidden Attempt to delete ‘default’ XML Policy None
404 Not Found Specified schema or XML Policy not found None
500 Internal Server Error Storage error None

Get All XML Policies

Code samples

# You can also use wget
curl -X GET /api/v1/xml-policies \
-H 'Accept: application/json'
GET /api/v1/xml-policies HTTP/1.1

Accept: application/json

const headers = {
'Accept':'application/json'
};

fetch('/api/v1/xml-policies',
{
method: 'GET',

headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'

headers = {
'Accept' => 'application/json'
}

result = RestClient.get '/api/v1/xml-policies',
params: {
}, headers: headers

p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}

r = requests.get('/api/v1/xml-policies', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
'Accept' => 'application/json',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
$response = $client->request('GET','/api/v1/xml-policies', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}

// ...
URL obj = new URL("/api/v1/xml-policies");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main

import (
"bytes"
"net/http"
)

func main() {

headers := map[string][]string{
"Accept": []string{"application/json"},
}

data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "/api/v1/xml-policies", data)
req.Header = headers

client := &http.Client{}
resp, err := client.Do(req)
// ...
}

GET /api/v1/xml-policies

Gets a full list of all configured XML Policies

Example responses

200 Response

[
{
"policyName": "default",
"isDefaultPolicy": true
}
]

Responses

Status Meaning Description Schema
200 OK A list of allXML Policies Inline
404 Not Found Specified schema or XML Policy not found None
500 Internal Server Error Issues occurred when attempting to access storage. None

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [GetAllPolicyItem] false none none
» policyName PolicyName false none none
» isDefaultPolicy IsDefaultPolicy false none none

Reset XML Policy

Code samples

# You can also use wget
curl -X PUT /api/v1/xml-policies/{XMLPolicyName}/reset \
-H 'Accept: application/json'
PUT /api/v1/xml-policies/{XMLPolicyName}/reset HTTP/1.1

Accept: application/json

const headers = {
'Accept':'application/json'
};

fetch('/api/v1/xml-policies/{XMLPolicyName}/reset',
{
method: 'PUT',

headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'

headers = {
'Accept' => 'application/json'
}

result = RestClient.put '/api/v1/xml-policies/{XMLPolicyName}/reset',
params: {
}, headers: headers

p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}

r = requests.put('/api/v1/xml-policies/{XMLPolicyName}/reset', headers = headers)

print(r.json())
<?php

require 'vendor/autoload.php';

$headers = array(
'Accept' => 'application/json',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
$response = $client->request('PUT','/api/v1/xml-policies/{XMLPolicyName}/reset', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}

// ...
URL obj = new URL("/api/v1/xml-policies/{XMLPolicyName}/reset");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main

import (
"bytes"
"net/http"
)

func main() {

headers := map[string][]string{
"Accept": []string{"application/json"},
}

data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "/api/v1/xml-policies/{XMLPolicyName}/reset", data)
req.Header = headers

client := &http.Client{}
resp, err := client.Do(req)
// ...
}

PUT /api/v1/xml-policies/{XMLPolicyName}/reset

Resets a named XML Policy to the default schema values

Parameters

Name In Type Required Description
XMLPolicyName path string true The name of the XML Policy to reset

Example responses

200 Response

{
"schemaName": "xmlvalidationv1",
"policyName": "default",
"policyIdentity": "11111111-1111-1111-1111-111111111111",
"policyVersion": 2,
"isDefaultPolicy": true,
"status": "enabled",
"policyLocation": "api/v1/schemas/xmlvalidationv1/policies/policyName"
}

Responses

Status Meaning Description Schema
200 OK XML Policy Updated WritePolicyBodyResponse
400 Bad Request XML Policy failed validation, reasons in response None
404 Not Found Specified schema or XML Policy not found None
500 Internal Server Error Issues occurred when attempting to access storage. None

Schemas

PolicyMetadata

{
"EnableWarningHandling": false,
"BlockedTags": [
"/XInclude:include",
"/XSL/Transform:stylesheet"
],
"AllowedEncodings": [
"utf-8",
"utf-16",
"iso-8859-1"
],
"AllowEmptyEncoding": true,
"AllowDoctypeInCData": false
}

Provides the policy metadata and link to where the full policy settings can be acquired.

Properties

Name Type Required Restrictions Description
EnableWarningHandling boolean false none Tells the XML Validation API to return warnings in the response when validating the input XML. Warnings are disabled by default.
AllowEmptyEncoding boolean false none Configures the ability to allow validation to pass if no character encoding is specified in the input XML.
AllowDoctypeInCData boolean false none Configures the XML Validation API to fail validation if it encounters a doctype declaration in the CDATA section. Alternatively this can be set to true to allow doctype declarations.
BlockedTags [string] false none Allows the XML Validation API to fail if it encounters any of these tags while validating the input XML.
AllowedEncodings [string] false none Allows users to specify which character encoding standard to allow in the input XML. If the XML validation API encounters a specified encoding, validation will fail and the encoding standard is identified in the ValidationResults object on the response.

Status

"enabled"

Properties

Name Type Required Restrictions Description
anonymous string false none none

Enumerated Values

Property Value
anonymous enabled
anonymous disabled

WritePolicyBody

{
"status": "enabled",
"policySettings": {
"EnableWarningHandling": false,
"BlockedTags": [
"/XInclude:include",
"/XSL/Transform:stylesheet"
],
"AllowedEncodings": [
"utf-8",
"utf-16",
"iso-8859-1"
],
"AllowEmptyEncoding": true,
"AllowDoctypeInCData": false
}
}

The policy settings to be set for a named policy

Properties

Name Type Required Restrictions Description
status Status false none none
policySettings PolicyMetadata true none Provides the policy metadata and link to where the full policy settings can be acquired.

WritePolicyBodyResponse

{
"schemaName": "xmlvalidationv1",
"policyName": "default",
"policyIdentity": "11111111-1111-1111-1111-111111111111",
"policyVersion": 2,
"isDefaultPolicy": true,
"status": "enabled",
"policyLocation": "api/v1/schemas/xmlvalidationv1/policies/policyName"
}

Properties

allOf

Name Type Required Restrictions Description
anonymous PolicyCommonProperties false none none

and

Name Type Required Restrictions Description
anonymous object false none none
» policyLocation PolicyLocation false none none

PolicyCommonProperties

{
"schemaName": "xmlvalidationv1",
"policyName": "default",
"policyIdentity": "11111111-1111-1111-1111-111111111111",
"policyVersion": 2,
"isDefaultPolicy": true,
"status": "enabled"
}

Properties

Name Type Required Restrictions Description
schemaName SchemaName false none Identifies the schema and its version. The format should be in the format of [name]v[version], consisting of only alphanumeric characters [A-Za-z0-9].
policyName PolicyName false none none
policyIdentity PolicyIdentity false none none
policyVersion PolicyVersion false none Identifies the version of the Policy.
isDefaultPolicy IsDefaultPolicy false none none
status Status false none none

SchemaName

"xmlvalidationv1"

Identifies the schema and its version. The format should be in the format of [name]v[version], consisting of only alphanumeric characters [A-Za-z0-9].

Properties

Name Type Required Restrictions Description
anonymous string false none Identifies the schema and its version. The format should be in the format of [name]v[version], consisting of only alphanumeric characters [A-Za-z0-9].

PolicyVersion

2

Identifies the version of the Policy.

Properties

Name Type Required Restrictions Description
anonymous integer false none Identifies the version of the Policy.

PolicyLocation

"api/v1/schemas/xmlvalidationv1/policies/policyName"

Properties

Name Type Required Restrictions Description
anonymous string(uri) false none none

PolicyIdentity

"11111111-1111-1111-1111-111111111111"

Properties

Name Type Required Restrictions Description
anonymous string(uuid) false none none

PolicyName

"default"

Properties

Name Type Required Restrictions Description
anonymous string false none none

IsDefaultPolicy

true

Properties

Name Type Required Restrictions Description
anonymous boolean false none none

GetAllPolicyItem

{
"policyName": "default",
"isDefaultPolicy": true
}

Properties

Name Type Required Restrictions Description
policyName PolicyName false none none
isDefaultPolicy IsDefaultPolicy false none none