Skip to content

Updating Obfuscations

Modify existing obfuscations using PUT (full replacement) or PATCH (partial update) operations.


PUT /api/obfuscations/:id

Replace the entire obfuscation with new configuration. All fields must be provided.

Endpoint

PUT /api/obfuscations/:id

Authentication

Requires API Key with Policy Definition permission.

Request Body

Same as creating an obfuscation - all fields required.

Response

Returns the updated obfuscation object with the new configuration.


PATCH /api/obfuscations/:id

Partially update an obfuscation. Only specified fields are modified.

Endpoint

PATCH /api/obfuscations/:id

Authentication

Requires API Key with Policy Definition permission.

Request Body

Provide only the fields you want to update:

{
  "description": "Updated description"
}

Response

Returns the updated obfuscation object:

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Mask PII",
  "description": "Updated description",
  "datatypes": [...],
  "filters": [...],
  "updatedAt": 1704240000
}

Examples

Update Obfuscation Description

Change only the description field using PATCH.

OBFUSCATION_ID="550e8400-e29b-41d4-a716-446655440000"

curl -X PATCH "https://your-shield-host:8080/api/obfuscations/$OBFUSCATION_ID" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"description": "Updated PII obfuscation policy"}'
import requests

BASE_URL = "https://your-shield-host:8080"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}

obfuscation_id = "550e8400-e29b-41d4-a716-446655440000"

response = requests.patch(
    f"{BASE_URL}/api/obfuscations/{obfuscation_id}",
    headers=HEADERS,
    json={"description": "Updated PII obfuscation policy"}
)

print(f"Updated: {response.json()['description']}")
const axios = require('axios');

const BASE_URL = 'https://your-shield-host:8080';
const HEADERS = { 'Authorization': 'Bearer YOUR_API_KEY' };

const obfuscationId = '550e8400-e29b-41d4-a716-446655440000';

const response = await axios.patch(
  `${BASE_URL}/api/obfuscations/${obfuscationId}`,
  { description: 'Updated PII obfuscation policy' },
  { headers: HEADERS }
);

console.log(`Updated: ${response.data.description}`);
Add Data Type to Obfuscation

Add a new data type to an existing obfuscation configuration.

import requests

BASE_URL = "https://your-shield-host:8080"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}

obfuscation_id = "550e8400-e29b-41d4-a716-446655440000"

# Get current obfuscation
obf = requests.get(f"{BASE_URL}/api/obfuscations/{obfuscation_id}", headers=HEADERS).json()

# Add email to datatypes list
obf["datatypes"].append({
    "type": "EMAIL_ADDRESS",
    "maskFormatId": "FULLY_OBFUSCATED",
    "storeOriginalValue": False,
    "whitelist": []
})

# Update obfuscation
response = requests.patch(
    f"{BASE_URL}/api/obfuscations/{obfuscation_id}",
    headers=HEADERS,
    json={"datatypes": obf["datatypes"]}
)

print(f"Now masking {len(response.json()['datatypes'])} data types")
const axios = require('axios');

const BASE_URL = 'https://your-shield-host:8080';
const HEADERS = { 'Authorization': 'Bearer YOUR_API_KEY' };

const obfuscationId = '550e8400-e29b-41d4-a716-446655440000';

// Get current obfuscation
const obfResponse = await axios.get(`${BASE_URL}/api/obfuscations/${obfuscationId}`, { headers: HEADERS });
const obf = obfResponse.data;

// Add email to datatypes list
obf.datatypes.push({
  type: 'EMAIL_ADDRESS',
  maskFormatId: 'FULLY_OBFUSCATED',
  storeOriginalValue: false,
  whitelist: []
});

// Update obfuscation
const updateResponse = await axios.patch(
  `${BASE_URL}/api/obfuscations/${obfuscationId}`,
  { datatypes: obf.datatypes },
  { headers: HEADERS }
);

console.log(`Now masking ${updateResponse.data.datatypes.length} data types`);
Update Whitelist

Modify the whitelist for a specific data type.

import requests

BASE_URL = "https://your-shield-host:8080"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}

obfuscation_id = "550e8400-e29b-41d4-a716-446655440000"

# Get current obfuscation
obf = requests.get(f"{BASE_URL}/api/obfuscations/{obfuscation_id}", headers=HEADERS).json()

# Update whitelist for first data type
obf["datatypes"][0]["whitelist"] = [
    "000-00-0000",
    "111-11-1111",
    "999-99-9999"
]

# Update obfuscation
response = requests.patch(
    f"{BASE_URL}/api/obfuscations/{obfuscation_id}",
    headers=HEADERS,
    json={"datatypes": obf["datatypes"]}
)

print("Whitelist updated")
const axios = require('axios');

const BASE_URL = 'https://your-shield-host:8080';
const HEADERS = { 'Authorization': 'Bearer YOUR_API_KEY' };

const obfuscationId = '550e8400-e29b-41d4-a716-446655440000';

// Get current obfuscation
const obfResponse = await axios.get(`${BASE_URL}/api/obfuscations/${obfuscationId}`, { headers: HEADERS });
const obf = obfResponse.data;

// Update whitelist for first data type
obf.datatypes[0].whitelist = [
  '000-00-0000',
  '111-11-1111',
  '999-99-9999'
];

// Update obfuscation
await axios.patch(
  `${BASE_URL}/api/obfuscations/${obfuscationId}`,
  { datatypes: obf.datatypes },
  { headers: HEADERS }
);

console.log('Whitelist updated');

Error Responses

Status Code Description
400 Invalid request body or validation error
401 Invalid or expired API key
403 Insufficient permissions (requires Policy Definition)
404 Obfuscation not found
409 Obfuscation name already exists (when changing name)