Skip to content

Unable to read Course of Action from opencti via python api #65

@sorenopsy

Description

@sorenopsy

Description

When trying to read a course of action following here is given:

INFO:root:Listing Course-Of-Actions with filters [{"key": "name", "values": ["bash_profile and .bashrc Mitigation"]}].
INFO:root:{"errors":[{"message":"Unknown type "CourseOfActionsFiltering". Did you mean "CoursesOfActionFiltering", "CoursesOfActionFilter", "CoursesOfActionOrdering", "OrganizationsFiltering", or "ThreatActorsFiltering"?","locations":[{"line":2,"column":46}],"extensions":{"code":"GRAPHQL_VALIDATION_FAILED"}},{"message":"Cannot query field "courseOfActions" on type "Query". Did you mean "courseOfAction" or "coursesOfAction"?","locations":[{"line":3,"column":17}],"extensions":{"code":"GRAPHQL_VALIDATION_FAILED"}}]}
Traceback (most recent call last):
File "get_coa.py", line 12, in
coa = opencti_api_client.course_of_action.read(filters=[{'key': 'name', 'values': ['bash_profile and .bashrc Mitigation']}])
File "/usr/local/lib/python3.7/dist-packages/pycti/entities/opencti_course_of_action.py", line 184, in read
result = self.list(filters=filters)
File "/usr/local/lib/python3.7/dist-packages/pycti/entities/opencti_course_of_action.py", line 153, in list
return self.opencti.process_multiple(result["data"]["courseOfActions"])
TypeError: 'NoneType' object is not subscriptable

Environment

  1. Opencti demo enviroment, pycti lib 2.1.14, python3

Reproducible Steps

python snipset

from pycti import OpenCTIApiClient

api_url = 'https://demo.opencti.io'
api_token = '609caced-7610-4c84-80b4-f3a380d1939b'
opencti_api_client = OpenCTIApiClient(api_url, api_token,debug)

coa = opencti_api_client.course_of_action.read(filters=[{'key': 'name', 'values': ['bash_profile and .bashrc Mitigation']}])

print(coa)

Metadata

Metadata

Assignees

Labels

buguse for describing something not working as expectedsolveduse to identify issue that has been solved (must be linked to the solving PR)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions