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'
POST /api/v1/xml-policies/{XMLPolicyName} HTTP/1.1

Content-Type: application/json
const inputBody = '{
"PolicySettings": null
}';
const headers = {
'Content-Type':'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'
}

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

p JSON.parse(result)
import requests
headers = {
'Content-Type': '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',
);

$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"},
}

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

{
"PolicySettings": null
}

Parameters

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

Responses

Status Meaning Description Schema
201 Created XML Policy Created None
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'
PUT /api/v1/xml-policies/{XMLPolicyName} HTTP/1.1

Content-Type: application/json
const inputBody = '{
"PolicySettings": null
}';
const headers = {
'Content-Type':'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'
}

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

p JSON.parse(result)
import requests
headers = {
'Content-Type': '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',
);

$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"},
}

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

{
"PolicySettings": null
}

Parameters

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

Responses

Status Meaning Description Schema
200 OK XML Policy Updated None
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}
GET /api/v1/xml-policies/{XMLPolicyName} HTTP/1.1

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

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

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

p JSON.parse(result)
import requests

r = requests.get('/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('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() {

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

Responses

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

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
GET /api/v1/xml-policies HTTP/1.1

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

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

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

p JSON.parse(result)
import requests

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

print(r.json())
<?php

require 'vendor/autoload.php';

$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() {

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

Responses

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

Reset XML Policy

Code samples

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

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

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

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

p JSON.parse(result)
import requests

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

print(r.json())
<?php

require 'vendor/autoload.php';

$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() {

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

Responses

Status Meaning Description Schema
200 OK XML Policy Updated None
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

WritePolicyBody

{
"PolicySettings": null
}

The XML Policy settings to be set for a named XML Policy

Properties

Name Type Required Restrictions Description
PolicySettings any true none none