Skip to content

Commit

Permalink
Adding DemistoDeleteIncidents command (#2055)
Browse files Browse the repository at this point in the history
* Adding DemistoDeleteIncidents command

* Added delete incident command to demisto Rest API

* Adding more email headers to the process email

* Fixing demisto-delete-incidents review.

* Removing command demito-delete-incident

* Removing command demito-delete-incident
  • Loading branch information
ronykoz authored and Anar Azadaliyev committed Sep 16, 2018
1 parent 4359aaa commit 6253759
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Integrations/integration-DemistoRESTAPI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,29 @@ script:
}
};
var deleteIncidents = function(ids_to_delete) {
var body = {
ids: ids_to_delete,
all: false,
filter: {}
};
var res = sendRequest('POST', '/incident/batchDelete', JSON.stringify(body));
if (isError(res[0])) {
throw res[0].Contents;
}
var response = res['response']
var md = tableToMarkdown('Demisto delete incidents', response, ['data', 'total', "notUpdated"]);
return {
ContentsFormat: formats.json,
Type: entryTypes.note,
Contents: res,
HumanReadable: md
};
};
switch (command) {
case 'test-module':
sendRequest('GET','user');
Expand Down Expand Up @@ -148,6 +171,9 @@ script:
}
var desc = args.description || '';
return ({Type: entryTypes.file, FileID: res.Path, File: filename, Contents: desc});
case 'demisto-delete-incidents':
var ids = argToList(args.ids);
return deleteIncidents(ids);
default:
throw 'Demisto REST APIs - unknown command';
}
Expand Down Expand Up @@ -209,4 +235,12 @@ script:
- name: body
description: Request body
description: Send HTTP Multipart request to upload files to Demisto server
- name: demisto-delete-incidents
arguments:
- name: ids
required: true
description: IDs of the incidents to delete
description: Delete Demisto incidents
execution: true
runonce: false
releaseNotes: "Added delete incident command"
2 changes: 2 additions & 0 deletions Scripts/script-DemistoDeleteIncident.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ scripttarget: 0
dependson:
must:
- demisto-api-post
deprecated: true
releaseNotes: "Deprecating DemistoDeleteIncident script."

0 comments on commit 6253759

Please sign in to comment.