API for create-detailed template [example]
Please refer to this API to work with the anonymization templates in case the API is required.
POST: ${base_url}/{contextPath}/rest/actonic-gdpr/2/tasks/-1/task/create-detailed
JSON Body:
{
"disableUsers": false | true,
"taskType": 0 | 1,
"scope": "JQL_SCOPE",
"sourceUsers": [
"username1",
"username2"
],
"targetUser": "targetUsername",
"objects": ["object1", "object2"],
"sharedObjects":["shared1", "shared2"],
"templateId": -1,
"scopeType": "jql"
}
Javascript example of creating a task with parameters for whole objects and shared objects got by rest API request.
Please do not forget to provide the correct parameters.
var createDetailedParams = {
"disableUsers": false | true,
"taskType": 0 | 1,
"scope": "JQL_SCOPE",
"sourceUsers": [
"username1",
"username2"
],
"targetUser": "targetUsername",
"templateId": -1,
"scopeType": "jql"
}
var objects = [];
var sharedObjects = [];
$.ajax({
url: AJS.contextPath() + "/rest/actonic-gdpr/2/general/config/useranonymizer",
type: "GET",
dataType: "json",
async: false,
success: function (data) {
objects = data.modules.useranonymizer.contentObjects.reduce((acc, it) => [...acc, it.key], []);
objects = objects.concat(data.modules.useranonymizer.userObjects.reduce((acc, it) => [...acc, it.key], []))
sharedObjects = data.modules.useranonymizer.sharedObjects.reduce((acc, it) => [...acc, it.key], []);
}
})
createDetailedParams.objects = objects;
createDetailedParams.sharedObjects = sharedObjects;
console.log(`objects to proceed = ${objects}`);
console.log(`sharedObjects to proceed = ${sharedObjects}`);
console.log("whole model to create-detailed request");
console.log(createDetailedParams);
$.ajax({
url: AJS.contextPath() + "/rest/actonic-gdpr/2/tasks/-1/task/create-detailed",
type: "POST",
contentType: "application/json",
dataType: "json",
data: JSON.stringify(createDetailedParams),
success: function (data, status, resp) {
console.log(`Result: ${data.status}`);
}
})