This repository was archived by the owner on Jun 2, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Tried add entity_add functionality but not working. #5
Copy link
Copy link
Open
Labels
Description
I am trying to add more functionality to the YetiApi class.
When I tried the get entity it worked, but for adding a entity it gives error
ERROR:root:An error occurred (500):
Any pointers towards this would be welcome, There was no documentation of json values of entity object so I did a get entity and used similar json object in entity_add
Following are my functions added to api.py
def entity_details(self, id):
"""Get details on an entity.
Args:
id: A string representing the entity's ObjectID
Returns:
JSON representation of the requested entity
"""
return self._make_get("entity/{}".format(id))
def entity_add(self, name,etype,description,aliases=[], tags=[],context={},source="API"):
"""Add an entity to the dataset
Args:
name: the name of entity
etype: type of entity ('Actor','TTP' etc)
description: description of Entity
tags: An array of strings representing tags
context: A dictionary object with context information
source: A string representing the source of the data. Defaults to
"API".
Returns:
JSON representation of the created observable.
"""
json = {
'description':description,
'tags':tags,
'aliases':aliases,
'type':etype,
'name':name,
'context':context,
'source':source
}
return self._make_post('entity/', json=json)
Reactions are currently unavailable