allow deletion of objects and object references

pull/144/head
c-goes 2017-11-23 17:51:04 +01:00
parent d4b8df380f
commit 4416fe30b1
1 changed files with 12 additions and 0 deletions

View File

@ -1617,12 +1617,24 @@ class PyMISP(object):
response = self.__prepare_request('POST', url, misp_object.to_json()) response = self.__prepare_request('POST', url, misp_object.to_json())
return self._check_response(response) return self._check_response(response)
def delete_object(self, id):
"""Deletes an object"""
url = urljoin(self.root_url, 'objects/delete/{}'.format(id))
response = self.__prepare_request('POST', url)
return self._check_response(response)
def add_object_reference(self, misp_object_reference): def add_object_reference(self, misp_object_reference):
"""Add a reference to an object""" """Add a reference to an object"""
url = urljoin(self.root_url, 'object_references/add') url = urljoin(self.root_url, 'object_references/add')
response = self.__prepare_request('POST', url, misp_object_reference.to_json()) response = self.__prepare_request('POST', url, misp_object_reference.to_json())
return self._check_response(response) return self._check_response(response)
def delete_object_reference(self, id):
"""Deletes a reference to an object"""
url = urljoin(self.root_url, 'object_references/delete/{}'.format(id))
response = self.__prepare_request('POST', url)
return self._check_response(response)
def get_object_templates_list(self): def get_object_templates_list(self):
"""Returns the list of Object templates available on the MISP instance""" """Returns the list of Object templates available on the MISP instance"""
url = urljoin(self.root_url, 'objectTemplates') url = urljoin(self.root_url, 'objectTemplates')