Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit 31412e7

Browse files
[client] delete example
1 parent 91aec69 commit 31412e7

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

examples/create_observable_sshkey.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
opencti_api_client = OpenCTIApiClient(api_url, api_token)
1111

1212
observable_sshkey = opencti_api_client.stix_cyber_observable.create(
13-
observableData={"type": "SSH-Key", "SSHKey": {"fingerprint_sha256": "sha256_test"}}
13+
observableData={"type": "SSH-Key", "fingerprint_sha256": "sha256_test"}
1414
)
1515

1616
print(observable_sshkey)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# coding: utf-8
2+
3+
from pycti import OpenCTIApiClient
4+
5+
# Variables
6+
api_url = "http://opencti:4000"
7+
api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159"
8+
9+
# OpenCTI initialization
10+
opencti_api_client = OpenCTIApiClient(api_url, api_token)
11+
12+
opencti_api_client.stix_cyber_observable.create(
13+
observableData={"type": "SSH-Key", "fingerprint_sha256": "sha256_test"}
14+
)
15+
16+
observable_sshkey = opencti_api_client.stix_cyber_observable.read(
17+
filters={
18+
"mode": "and",
19+
"filters": [{"key": "fingerprint_sha256", "values": ["sha256_test"]}],
20+
"filterGroups": [],
21+
}
22+
)
23+
24+
opencti_api_client.stix_cyber_observable.delete(id=observable_sshkey.get("id"))

0 commit comments

Comments
 (0)