Hello
I have used the patch method to update an incident in the fn_secureworks_ctp integration found in our public github
here.
This is the function that uses patch:
def _update_incident(self, incident_id, incident_payload):
""" _update_incident will update an incident with the specified json payload.
:param incident_id: incident ID of incident to be updated.
;param incident_payload: incident fields to be updated.
:return:
"""
try:
# Update incident
incident_url = "/incidents/{0}".format(incident_id)
incident = self.rest_client().get(incident_url)
patch = resilient.Patch(incident)
# Iterate over payload dict.
for name, value in incident_payload.items():
if name == 'properties':
for field_name, field_value in incident_payload['properties'].items():
patch.add_value(field_name, field_value)
else:
payload_value = incident_payload.get(name)
patch.add_value(name, payload_value)
patch_result = self.rest_client().patch(incident_url, patch)
result = self._chk_status(patch_result)
return result if result else {}
except Exception as err:
raise IntegrationError(err)
I don't know of any documentation on the use of patch.
Hope this helps!
AnnMarie
------------------------------
AnnMarie Norcross
------------------------------