+++ # ----------------------------------------------------------------------- # Do not edit this file. It is automatically generated by API Documenter. # ----------------------------------------------------------------------- title = "DataSourceSrv" keywords = ["grafana","documentation","sdk","@grafana/runtime"] type = "docs" +++ ## DataSourceSrv interface This is the entry point for communicating with a datasource that is added as a plugin (both external and internal). Via this service you will get access to the [DataSourceApi](./data/datasourceapi.md) that have a rich API for communicating with the datasource. Signature ```typescript export interface DataSourceSrv ``` Import ```typescript import { DataSourceSrv } from '@grafana/runtime'; ``` Methods | Method | Description | | --- | --- | | [get(name, scopedVars)](#get-method) | | | [getDataSourceSettingsByUid(uid)](#getdatasourcesettingsbyuid-method) | Returns metadata based on UID. | ### get method Signature ```typescript get(name?: string, scopedVars?: ScopedVars): Promise; ``` Parameters | Parameter | Type | Description | | --- | --- | --- | | name | string | name of the datasource plugin you want to use. | | scopedVars | ScopedVars | variables used to interpolate a templated passed as name. | Returns: `Promise` ### getDataSourceSettingsByUid method Returns metadata based on UID. Signature ```typescript getDataSourceSettingsByUid(uid: string): DataSourceInstanceSettings | undefined; ``` Parameters | Parameter | Type | Description | | --- | --- | --- | | uid | string | | Returns: `DataSourceInstanceSettings | undefined`