@@ -138,6 +138,7 @@ def create(self, **kwargs):
138138 url = kwargs .get ("url" , None )
139139 external_id = kwargs .get ("external_id" , None )
140140 description = kwargs .get ("description" , None )
141+ x_opencti_stix_ids = kwargs .get ("x_opencti_stix_ids" , None )
141142 update = kwargs .get ("update" , False )
142143
143144 if source_name is not None and url is not None :
@@ -166,6 +167,7 @@ def create(self, **kwargs):
166167 "external_id" : external_id ,
167168 "description" : description ,
168169 "url" : url ,
170+ "x_opencti_stix_ids" : x_opencti_stix_ids ,
169171 "update" : update ,
170172 }
171173 },
@@ -183,31 +185,25 @@ def create(self, **kwargs):
183185 Update a External Reference object field
184186
185187 :param id: the External Reference id
186- :param key: the key of the field
187- :param value: the value of the field
188+ :param input: the input of the field
188189 :return The updated External Reference object
189190 """
190191
191192 def update_field (self , ** kwargs ):
192193 id = kwargs .get ("id" , None )
193- key = kwargs .get ("key" , None )
194- value = kwargs .get ("value" , None )
195- if id is not None and key is not None and value is not None :
196- self .opencti .log (
197- "info" , "Updating External-Reference {" + id + "} field {" + key + "}."
198- )
194+ input = kwargs .get ("input" , None )
195+ if id is not None and input is not None :
196+ self .opencti .log ("info" , "Updating External-Reference {" + id + "}." )
199197 query = """
200- mutation ExternalReferenceEdit($id: ID!, $input: EditInput!) {
198+ mutation ExternalReferenceEdit($id: ID!, $input: [ EditInput] !) {
201199 externalReferenceEdit(id: $id) {
202200 fieldPatch(input: $input) {
203201 id
204202 }
205203 }
206204 }
207205 """
208- result = self .opencti .query (
209- query , {"id" : id , "input" : {"key" : key , "value" : value }}
210- )
206+ result = self .opencti .query (query , {"id" : id , "input" : input })
211207 return self .opencti .process_multiple_fields (
212208 result ["data" ]["externalReferenceEdit" ]["fieldPatch" ]
213209 )
0 commit comments