+++ # ----------------------------------------------------------------------- # Do not edit this file. It is automatically generated by API Documenter. # ----------------------------------------------------------------------- title = "DataSourceWithBackend" keywords = ["grafana","documentation","sdk","@grafana/runtime"] type = "docs" +++ ## DataSourceWithBackend class Extend this class to implement a data source plugin that is depending on the Grafana backend API. Signature ```typescript export declare class DataSourceWithBackend extends DataSourceApi ``` Import ```typescript import { DataSourceWithBackend } from '@grafana/runtime'; ``` Constructors | Constructor | Modifiers | Description | | --- | --- | --- | | [constructor(instanceSettings)](#constructor-instancesettings) | | Constructs a new instance of the DataSourceWithBackend class | Methods | Method | Modifiers | Description | | --- | --- | --- | | [applyTemplateVariables(query)](#applytemplatevariables-method) | | Override to apply template variables | | [callHealthCheck()](#callhealthcheck-method) | | Run the datasource healthcheck | | [getResource(path, params)](#getresource-method) | | Make a GET request to the datasource resource path | | [postResource(path, body)](#postresource-method) | | Send a POST request to the datasource resource path | | [query(request)](#query-method) | | Ideally final -- any other implementation may not work as expected | | [testDatasource()](#testdatasource-method) | | Checks the plugin health | | [toDataQueryResponse(rsp)](#todataqueryresponse-method) | | This makes the arrow library loading async. | ### constructor(instanceSettings) Constructs a new instance of the `DataSourceWithBackend` class Signature ```typescript constructor(instanceSettings: DataSourceInstanceSettings); ``` Parameters | Parameter | Type | Description | | --- | --- | --- | | instanceSettings | DataSourceInstanceSettings<TOptions> | | ### applyTemplateVariables method Override to apply template variables Signature ```typescript /** @virtual */ applyTemplateVariables(query: DataQuery): DataQuery; ``` Parameters | Parameter | Type | Description | | --- | --- | --- | | query | DataQuery | | Returns: `DataQuery` ### callHealthCheck method Run the datasource healthcheck Signature ```typescript callHealthCheck(): Promise; ``` Returns: `Promise` ### getResource method Make a GET request to the datasource resource path Signature ```typescript getResource(path: string, params?: any): Promise; ``` Parameters | Parameter | Type | Description | | --- | --- | --- | | path | string | | | params | any | | Returns: `Promise` ### postResource method Send a POST request to the datasource resource path Signature ```typescript postResource(path: string, body?: any): Promise; ``` Parameters | Parameter | Type | Description | | --- | --- | --- | | path | string | | | body | any | | Returns: `Promise` ### query method Ideally final -- any other implementation may not work as expected Signature ```typescript query(request: DataQueryRequest): Observable; ``` Parameters | Parameter | Type | Description | | --- | --- | --- | | request | DataQueryRequest | | Returns: `Observable` ### testDatasource method Checks the plugin health Signature ```typescript testDatasource(): Promise; ``` Returns: `Promise` ### toDataQueryResponse method This makes the arrow library loading async. Signature ```typescript toDataQueryResponse(rsp: any): Promise; ``` Parameters | Parameter | Type | Description | | --- | --- | --- | | rsp | any | | Returns: `Promise`