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
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 |
Returns:
Observable http request interface
Signature
fetch<T>(options: BackendSrvRequest): Observable<FetchResponse<T>>;
Parameters
Returns:
get method
Signature
get(url: string, params?: any, requestId?: string): Promise<any>;
Parameters
Parameter | Type | Description |
---|---|---|
url | string | |
params | any | |
requestId | string |
Returns:
Promise<any>
Signature
Parameters
Parameter | Type | Description |
---|---|---|
url | string | |
data | any |
Returns:
post method
Signature
Parameters
Returns:
Promise<any>
Signature
Parameters
Parameter | Type | Description |
---|---|---|
url | string | |
data | any |
Returns:
Promise<any>
request method
Signature
Parameters
Parameter | Type | Description |
---|---|---|
options | BackendSrvRequest |
Returns: