client-python icon indicating copy to clipboard operation
client-python copied to clipboard

ERROR while using stix2.export_entity | " 'Cannot query field "x_opencti_reliability" "

Open TheGreenmouse opened this issue 2 years ago • 1 comments

Description

Hello, I tried to get a report from STIX2, using the "Standard STIX ID". But I get the error 'Cannot query field "x_opencti_reliability"

Environment

  1. Windows 10 via Python
  2. OpenCTI version: 5.9.4
  3. Other environment details:

Reproducible Steps

I just want to get a report from my OpenCTI using Python :

from pycti import OpenCTIApiClient
import json

api_url = "https://192.168.0.25"
api_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

opencti_api_client = OpenCTIApiClient(api_url, api_token)

report = opencti_api_client.stix2.export_entity("Report", "report--1f561489-3344-54f8-a6fd-1c1d5505bf15", "full")
print(report)

Expected Output

The report.

Actual Output

INFO:pycti.entities:Reading Report {78c46a28-87e8-421a-814a-022eb86a5e77}. ERROR:pycti.api:Cannot query field "x_opencti_reliability" on type "Identity". Did you mean to use an inline fragment on "Organization"? Traceback (most recent call last): File "c:\Users\xxxx\pyopenctiv2.py", line 63, in report = opencti_api_client.report.get_by_stix_id_or_name(stix_id="78c46a28-87e8-421a-814a-022eb86a5e77") File "C:\Users\basti\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pycti\entities\opencti_report.py", line 612, in get_by_stix_id_or_name object_result = self.read(id=stix_id, customAttributes=custom_attributes) File "C:\Users\xxxxxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pycti\entities\opencti_report.py", line 587, in read result = self.opencti.query(query, {"id": id}) File "C:\Users\xxxxxxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pycti\api\opencti_api_client.py", line 374, in query raise ValueError( ValueError: {'name': 'Cannot query field "x_opencti_reliability" on type "Identity". Did you mean to use an inline fragment on "Organization"?', 'message': 'Cannot query field "x_opencti_reliability" on type "Identity". Did you mean to use an inline fragment on "Organization"?'}

TheGreenmouse avatar Oct 30 '23 15:10 TheGreenmouse

Hello @TheGreenmouse, Does your python client have the same version as opencti ? x_opencti_reliability is well defined in Identity type, but was added in 5.10.

SouadHadjiat avatar Dec 27 '23 10:12 SouadHadjiat