Core Resources

The Luminary API is primarily organized around several “core resources”. The majority of the API functionality is defined as operations on these resources:

Each resource will generally have the basic CRUD operations (create, read, update, and delete). For example, the Simulation resource has:

Some resources may have additional operations specific to that resource, for example download_surface_output is defined on the Simulation resource.

Resource IDs

Each resource you create in the API will have a globally unique ID. The IDs are strings of the format: <prefix>-<unique id>, where prefix varies based on the resource type. Some example resource IDs are shown in the table below.

Resource Type

Example ID

Project

p-dyd4voqsbm62m4nt6ychnrib4e01x5nq7k6tzn2f64cillg14b

Mesh

mesh-0d570a5a-169f-4c6f-b851-6283bcbf0e37

Simulation

sim-a8f0b812-9a5e-4fe7-ab72-4787476cd662

There are two primary ways to access resources you have previously created: get APIs and list APIs.

If you already have the ID of the resource you’d like to access, you can simply use the get API corresponding to the resource type, for example:

import luminarycloud as lc

my_project = lc.get_project("p-dyd4voqsbm62m4nt6ychnrib4e01x5nq7k6tzn2f64cillg14b")
my_sim = lc.get_simulation("sim-a8f0b812-9a5e-4fe7-ab72-4787476cd662")

If you don’t have a resource ID, you can use list APIs to find what you need:

import luminarycloud as lc

all_projects = lc.list_projects()
for p in projects:
  # print out the project info to help us find the one we want
  print(p.id, p.name, p.description)

# let's pick the first project
my_project = all_projects[0]

# list all meshes that are available in this project
meshes_in_my_project = my_project.list_meshes()