A Python library for the JupiterOne API.
Requires Python 3.6+
pip install jupiterone
fromjupiteroneimportJupiterOneClientj1=JupiterOneClient(
account='<yourAccountId>',
token='<yourApiToken>'
)QUERY='FIND Host'query_result=j1.query_v1(QUERY)
# Using LIMIT and SKIP for paginationquery_result=j1.query_v1(QUERY, limit=5, skip=5)
# Including deleted entitiesquery_result=j1.query_v1(QUERY, include_deleted=True)
# Tree queryQUERY='FIND Host RETURN TREE'query_result=j1.query_v1(QUERY)Note that the CreateEntity mutation behaves like an upsert, so an non-existant entity will be created or an existing entity will be updated.
properties= {
'myProperty': 'myValue',
'tag.myTagProperty': 'value_will_be_a_tag'
}
entity=j1.create_entity(
entity_key='my-unique-key',
entity_type='my_type',
entity_class='MyClass',
properties=properties,
timestamp=int(time.time()) *1000# Optional, defaults to current datetime
)
print(entity['entity'])Only send in properties you want to add or update, other existing properties will not be modified.
properties= {
'newProperty': 'newPropertyValue'
}
j1.update_entity(
entity_id='<id-of-entity-to-update>',
properties=properties
)j1.delete_entity(entit_id='<id-of-entity-to-delete>')j1.create_relationship(
relationship_key='this_entity_relates_to_that_entity',
relationship_type='my_relationship_type',
relationship_class='MYRELATIONSHIP',
from_entity_id='<id-of-source-entity>',
to_entity_id='<id-of-destination-entity>'
)j1.delete_relationship(relationship_id='<id-of-relationship-to-delete>')