The request function can be used to perform a remote call by specifying a BackendSrvRequest. To make the BackendSrv a bit easier to use we have added a couple of shorthand functions that will use default values executing the request.
Signature
Import
Remarks
By default, Grafana displays an error message alert if the remote call fails. To prevent this from happening showErrorAlert = true
on the options object.
Methods
Special function used to communicate with datasources that will emit core events that the Grafana QueryInspector and QueryEditor is listening for to be able to display datasource query information. Can be skipped by adding option.silent
when initializing the request.
Signature
datasourceRequest<T = any>(options: BackendSrvRequest): Promise<FetchResponse<T>>;
Parameters
Parameter | Type | Description |
---|---|---|
options | BackendSrvRequest |
Returns:
Promise<FetchResponse<T>>
delete method
Signature
Parameters
Parameter | Type | Description |
---|---|---|
url | string | |
data | any |
Promise<T>
Observable http request interface
Signature
Parameters
Returns:
Observable<FetchResponse<T>>
get method
Signature
get<T = any>(url: string, params?: any, requestId?: string): Promise<T>;
Parameters
Parameter | Type | Description |
---|---|---|
url | string | |
params | any | |
requestId | string |
Returns:
Promise<T>
Signature
Parameters
Parameter | Type | Description |
---|---|---|
url | string | |
data | any |
post method
Signature
post<T = any>(url: string, data?: any): Promise<T>;
Parameters
Returns:
Promise<T>
Signature
Parameters
Parameter | Type | Description |
---|---|---|
url | string | |
data | any |
Returns:
Promise<T>
request method
Signature
Parameters
Parameter | Type | Description |
---|---|---|
options | BackendSrvRequest |
Returns: