pycti.entities.opencti_external_reference
=========================================
.. py:module:: pycti.entities.opencti_external_reference
Classes
-------
.. autoapisummary::
pycti.entities.opencti_external_reference.ExternalReference
Module Contents
---------------
.. py:class:: ExternalReference(opencti)
Main ExternalReference class for OpenCTI
Manages external references and citations in the OpenCTI platform.
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
:type opencti: OpenCTIApiClient
Initialize the ExternalReference instance.
:param opencti: OpenCTI API client instance
:type opencti: OpenCTIApiClient
.. py:attribute:: opencti
.. py:attribute:: properties
:value: Multiline-String
.. raw:: html
Show Value
.. code-block:: python
"""
id
standard_id
entity_type
parent_types
created_at
updated_at
created
modified
source_name
description
url
hash
external_id
"""
.. raw:: html
.. py:attribute:: properties_with_files
:value: Multiline-String
.. raw:: html
Show Value
.. code-block:: python
"""
id
standard_id
entity_type
parent_types
created_at
updated_at
created
modified
source_name
description
url
hash
external_id
importFiles {
edges {
node {
id
name
size
metaData {
mimetype
version
}
objectMarking {
id
standard_id
entity_type
definition_type
definition
created
modified
x_opencti_order
x_opencti_color
}
}
}
}
"""
.. raw:: html
.. py:method:: generate_id(url=None, source_name=None, external_id=None)
:staticmethod:
Generate a STIX ID for an External Reference.
:param url: The URL of the external reference
:type url: str or None
:param source_name: The source name
:type source_name: str or None
:param external_id: The external ID
:type external_id: str or None
:return: STIX ID for the external reference, or None if insufficient parameters
:rtype: str or None
.. py:method:: generate_id_from_data(data)
:staticmethod:
Generate a STIX ID from external reference data.
:param data: Dictionary containing 'url', 'source_name', or 'external_id' keys
:type data: dict
:return: STIX ID for the external reference
:rtype: str or None
.. py:method:: list(**kwargs)
List External-Reference objects.
:param filters: the filters to apply
:type filters: dict
:param first: return the first n rows from the after ID (or the beginning if not set)
:type first: int
:param after: ID of the first row for pagination
:type after: str
:param orderBy: field to order results by
:type orderBy: str
:param orderMode: ordering mode (asc/desc)
:type orderMode: str
:param customAttributes: custom attributes to return
:type customAttributes: list
:param getAll: whether to retrieve all results
:type getAll: bool
:param withPagination: whether to include pagination info
:type withPagination: bool
:param withFiles: whether to include files
:type withFiles: bool
:return: List of External-Reference objects
:rtype: list
.. py:method:: read(**kwargs)
Read an External-Reference object.
:param id: the id of the External-Reference
:type id: str
:param filters: the filters to apply if no id provided
:type filters: dict
:return: External-Reference object
:rtype: dict or None
.. py:method:: create(**kwargs)
Create an External Reference object.
:param stix_id: (optional) the STIX ID
:type stix_id: str
:param created: (optional) creation date
:type created: datetime
:param modified: (optional) modification date
:type modified: datetime
:param source_name: the source name of the External Reference (required if no url)
:type source_name: str
:param url: (optional) the URL of the external reference (required if no source_name)
:type url: str
:param external_id: (optional) the external ID
:type external_id: str
:param description: (optional) description
:type description: str
:param x_opencti_stix_ids: (optional) list of additional STIX IDs
:type x_opencti_stix_ids: list
:param update: (optional) whether to update if exists (default: False)
:type update: bool
:param files: (optional) list of File objects to attach
:type files: list
:param filesMarkings: (optional) list of lists of marking definition IDs for each file
:type filesMarkings: list
:return: External Reference object
:rtype: dict or None
.. py:method:: add_file(**kwargs)
Upload a file in this External-Reference.
:param id: the External-Reference id
:type id: str
:param file_name: the name of the file to upload
:type file_name: str
:param data: the file data (if None, reads from file_name path)
:type data: bytes or None
:param version: (optional) the file version date
:type version: datetime
:param fileMarkings: (optional) list of marking definition IDs for the file
:type fileMarkings: list
:param mime_type: (optional) MIME type (default: text/plain)
:type mime_type: str
:param no_trigger_import: (optional) don't trigger import (default: False)
:type no_trigger_import: bool
:param embedded: (optional) embed the file (default: False)
:type embedded: bool
:return: File upload result
:rtype: dict or None
.. py:method:: update_field(**kwargs)
Update an External Reference object field.
:param id: the External Reference id
:type id: str
:param input: the input of the field
:type input: list
:return: The updated External Reference object
:rtype: dict or None
.. py:method:: delete(id)
Delete an External-Reference object.
:param id: the id of the External-Reference to delete
:type id: str
:return: None
.. py:method:: list_files(**kwargs)
List files attached to an External-Reference.
:param id: the id of the External-Reference
:type id: str
:return: List of files
:rtype: list