Skip to main content

API Examples

In this page collects some examples to use the API with other plugins of Obsidian community.

Templater

Active sprint data

<%* const projectKey = 'AAA' %>
Sprint Name: <%* tR += await $ji.macro.getActiveSprintName(projectKey) %>
Sprint Start: <%* tR += (await $ji.macro.getActiveSprint(projectKey)).startDate %>
Sprint End: <%* tR += (await $ji.macro.getActiveSprint(projectKey)).endDate %>

Loop on search results

<%* const query = `project = "AAA" AND assignee = currentUser() AND resolution = Unresolved` %>
<%* const searchResults = await $ji.base.getSearchResults(query) %>
<%* for(const issue of searchResults.issues) { %>
## <%* tR += `${issue.key} - ${issue.fields.summary}` %>

Description
```
<%* tR += issue.fields.description %>
```
<%* } %>

Dataview

Obsidian chart

getWorklogPerDay

```dataviewjs
const projectKey = 'AAA'
const sprint = await $ji.macro.getActiveSprint(projectKey)
const chartData = await $ji.chart.getWorklogPerDay(projectKey, sprint.startDate, sprint.endDate)
dv.paragraph(chartData, this.container)
```