diff --git a/pycti/api/opencti_api_client.py b/pycti/api/opencti_api_client.py index cbc1804cf..44e79ce65 100644 --- a/pycti/api/opencti_api_client.py +++ b/pycti/api/opencti_api_client.py @@ -351,6 +351,27 @@ def update_stix_domain_entity_field(self, id, key, value): } }) + def update_stix_observable_field(self, id, key, value): + logging.info('Updating field ' + key + ' of ' + id + '...') + query = """ + mutation StixObservableEdit($id: ID!, $input: EditInput!) { + stixObservableEdit(id: $id) { + fieldPatch(input: $input) { + id + observable_value + entity_type + } + } + } + """ + self.query(query, { + 'id': id, + 'input': { + 'key': key, + 'value': value + } + }) + def update_stix_relation_field(self, id, key, value): logging.info('Updating field ' + key + ' of ' + id + '...') query = """ @@ -3234,7 +3255,7 @@ def create_stix_observable_if_not_exists(self, object_result = self.get_stix_observable_by_value(observable_value) if object_result is not None: if update: - self.update_stix_domain_entity_field(object_result['id'], 'description', description) + self.update_stix_observable_field(object_result['id'], 'description', description) object_result['description'] = description return object_result else: