Export API

The Logilica platform enables you to query your data using a semantic data layer.

Using the API

The following example shows how to use the Export API to fetch the average lead time for tickets within a workspace.

The cURL GET command is below. Note, that the GET command includes the example API token lgca_UeRxFs_3RYRJEJtdYp7j7Wa6DirG5NjiYslsb and the example workspace myworkspace.

curl --location  -G 'https://logilica.io/api/query/load' \
    --header 'X-lgca-token: lgca_UeRxFs_3RYRJEJtdYp7j7Wa6DirG5NjiYslsb' \
    --header 'x-lgca-domain: myworkspace' \
    --data-urlencode 'query={
        "measures":["JiraIssueDetail.avgLeadTime"],
        "dimensions":[],
        "filters":[],
        "timeDimensions":[]}'

The above query returns the following response.

{
    "query": {
        "measures": [
            "JiraIssueDetail.avgLeadTime"
        ],
        "dimensions": [],
        "filters": [],
        "timeDimensions": [],
        "limit": 10000,
        "timezone": "UTC",
        "rowLimit": 10000
    },
    "data": [
        {
            "JiraIssueDetail.avgLeadTime": 1353.4052033405958
        }
    ],
    "lastRefreshTime": "2024-10-31T04:57:55.297Z"
    // ... additional metadata
}

The result of the query is provided in the data field of the response. The query that was run is also returned, along with some other metadata including the last time the data was refreshed by the semantic layer.

Query Format

Queries to the semantic layer are constructed as JSON objects, and have the following fields:

FieldTypeDescription

dimensions

string[]

A list of dimensions as found in the DataStudio Data Model

measures

string[]

A list of measures as found in the DataStudio Data Model

filters

Filter[]

A list of filter objects to apply to the query

timeDimensions

TimeDimensions[]

A list of time dimensions to filter the query on

order

object

Key/value pairs of measures/dimensions and direction to sort ("asc" or "desc")

Each of these fields are required, however they may be empty (e.g. an empty list or an object with no keys).

Below is an example query that fetches the number of Resolved ticket events for the team "Example Team" per Jira Issue Type for the month of October 2024. This shows the weekly ticket throughput for the team.

{
    "measures": [
        "JiraIssueEvent.eventCount"
    ],
    "dimensions": [
        "JiraIssueDetail.type"
    ]
    "timeDimensions": [
        {
            "dimension": "JiraIssueEvent.timeInterval",
            "granularity": "week",
            "dateRange": [ "2024-10-01", "2024-10-31" ]
        }
    ],
    "filters": [
        {
            "member": "JiraIssueEvent.event",
            "operator": "equals",
            "values": [
                "Resolved"
            ]
        },
        {
            "member": "JiraIssueDetail.statusCategory",
            "operator": "equals",
            "values": [
                "Done"
            ]
        },
        {
            "member": "Team.name",
            "operator": "equals",
            "values:" [ "Example Team" ]
        }
    ],
    "order": {
        "JiraIssueDetail.type": "asc"
    },

}

Filters

Filters are objects that specify how to filter the data with respect to the dimensions and measures available. They contain the following fields:

FieldTypeDescription

member

string

The dimension or measure to use in the filter, a list of these can be found in the DataStudio Data Model

operator

filter-operator

The comparison operator to use in the filter. One of equals, notEquals, contains, notContains, startsWith, notStartsWith, endsWith, notEndsWith, gt, gte, lt, lte, set, notSet . See below for more information.

values

string[]

Array of values for the filter. These must be of type string, with numbers being converted from strings by the semantic layer.

Both the member and operator field are required, the value field is only required for some operators.

Filter Operators

  • equals - matches exactly on the values in the array

  • contains - a case insensitive wild card match on the values in the array (similar to LIKE %)

  • startsWith - matches any string that starts with one of the values in the values array

  • endsWith - matches any string that ends with one of the values in the values array

  • gt - matches numeric values greater than the value in the values array

  • gte - matches numeric values greater than or equal to the value in the values array

  • lt - matches numeric values less than the value in the values array

  • lte - matches numeric values less than or equal to the value in the values array

  • set - checks if the value is not null. This operator does not use the values array

A number of filter operators have a not equivalent (e.g. notEquals). These are the negations of the relevant operator. The not operators available are: notEquals, notContains, notStartsWith, notEndsWith and notSet.

Time Dimensions

Time dimensions are filters specifically on time intervals. These allow you to specify the time interval you wish to fetch in your dataset.

FieldTypeDescription

dimension

string

The time dimension to use. These can be found in the DataStudio Data Model and typically have the name timeInterval

dateRange

string[]

An array of two date strings, the first being the start time and the second being the end. For example, [ "2024-10-01", "2024-10-31" ]

granularity

string

The granularity to group the data by. Can be days, weeks, months, years

Both dimension and dateRange are required fields. Omitting granularity is permitted and will mean that your data is ungrouped by time.

Last updated