02. Navigate and Search
How to navigate and search through Jinko's API
Jinko's API allows you to navigate through various project items and search for specific resources.
This section covers how to perform these actions using the jinko-sdk.
Navigating Project Items
You can iterate over all project items in your project, or fetch them page by page. Here's an example:
from jinko import JinkoClient
client = JinkoClient()
# Iterate over every project item (handles pagination for you)
for item in client.iter_project_items():
print(item.sid, item.type, item.name)
# Or fetch a single page
page = client.list_project_items(limit=50)
for item in page.items:
print(item.sid, item.type, item.name)
Searching for Project Items by Name
You can search for specific project items using filters such as the project item's name. Here's how to search for a project item by its name:
from jinko import JinkoClient
client = JinkoClient()
# Search for project items with a specific name
name = "Example Project"
results = client.search(text=name, name_only=True)
Searching by Type
You can also search for specific types of project items, such as models or trials. Here's how to search by type:
from jinko import JinkoClient
client = JinkoClient()
# Search for project items of type 'ComputationalModel' or 'Trial'
results = client.search(types=["ComputationalModel", "Trial"])
search prints its results as a table by default (pass show_table=False to suppress this) and also returns the matching typed project items, so you can keep working with them programmatically.
This method allows you to quickly locate specific project items within your Jinko workspace.