> Documentation index: https://www.gooddata.ai/docs/gooddata-ui/llms.txt lists every page of these docs as Markdown.

# IAnalyticalBackend

- Package: [@gooddata/sdk-backend-spi](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/index.md)
- Kind: interface
- Source: https://github.com/gooddata/gooddata-ui-sdk/blob/rel/11.64/libs/sdk-backend-spi/src/backend/index.ts

The root of the Analytical Backend SPI.

**Signature:**

```typescript
export interface IAnalyticalBackend 
```

## Remarks

It allows configuration related to communication with the backend and access to analytical workspaces.

The analytical backend instance MUST be immutable. Changes to configuration of the backend MUST create a new instance to work with.

## Properties

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [capabilities](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md#ianalyticalbackendcapabilities) | `readonly` | [IBackendCapabilities](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ibackendcapabilities/index.md) | Capabilities available on this backend. |
| [config](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md#ianalyticalbackendconfig) | `readonly` | [IAnalyticalBackendConfig](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackendconfig/index.md) | Configuration used for communication with this backend. |

## Methods

| Method | Description |
| --- | --- |
| [authenticate(force)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md#ianalyticalbackendauthenticate) | Triggers authentication process against the backend. |
| [currentUser()](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md#ianalyticalbackendcurrentuser) | Returns a service for interacting with the currently authenticated user. |
| [dataSources()](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md#ianalyticalbackenddatasources) | Returns service that can be used to work with data sources. |
| [deauthenticate(returnTo)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md#ianalyticalbackenddeauthenticate) | Triggers deauthentication process against the backend. |
| [entitlements()](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md#ianalyticalbackendentitlements) | Returns service that can be used to obtain license entitlements. |
| [geo()](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md#ianalyticalbackendgeo) | Returns service that can be used to load geo location assets. |
| [isAuthenticated()](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md#ianalyticalbackendisauthenticated) | Tests authentication against this backend. |
| [onHostname(hostname)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md#ianalyticalbackendonhostname) | Creates new instance of backend on the provided hostname. |
| [organization(organizationId)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md#ianalyticalbackendorganization) | Returns an organization available on the backend. |
| [organizations()](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md#ianalyticalbackendorganizations) | Returns a service that can be obtained to obtain organizations. |
| [withAuthentication(provider)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md#ianalyticalbackendwithauthentication) | Sets authentication provider to be used when backend discovers current session is not authenticated. |
| [withCorrelation(correlationMetadata)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md#ianalyticalbackendwithcorrelation) | Sets request correlation metadata that will be included in HTTP requests to the backend. If the [IAnalyticalBackend](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md) instance already has correlation metadata set, the new metadata will be merged with the existing one. This method provides more flexibility than withTelemetry by allowing arbitrary key-value pairs to be sent. |
| [withTelemetry(componentName, props)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md#ianalyticalbackendwithtelemetry) | Sets telemetry information that SHOULD be sent to backend to track component usage. |
| [workspace(id)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md#ianalyticalbackendworkspace) | Returns an analytical workspace available on this backend. |
| [workspaces()](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md#ianalyticalbackendworkspaces) | Returns service that can be used to obtain available workspaces. |

## Property details

### IAnalyticalBackend.capabilities

Capabilities available on this backend.

**Signature:**

```typescript
readonly capabilities: IBackendCapabilities;
```

### IAnalyticalBackend.config

Configuration used for communication with this backend.

**Signature:**

```typescript
readonly config: IAnalyticalBackendConfig;
```

## Method details

### IAnalyticalBackend.authenticate()

Triggers authentication process against the backend.

**Signature:**

```typescript
authenticate(force?: boolean): Promise<IAuthenticatedPrincipal>;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| force | boolean | _(Optional)_ indicates whether authentication should be forced = must always be done even if the current session is already authenticated; defaults to false |

**Returns:**

Promise&lt;[IAuthenticatedPrincipal](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iauthenticatedprincipal/index.md)&gt;

promise of authenticated principal, or rejection if authentication has failed.

#### Remarks

If the 'force' parameter is specified, then the method MUST always lead to a call to the authentication provider.

If the 'force' parameter is not specified, then the method MAY lead to a call to the authentication provider - if the backend lives in an already authenticated session, principal is returned. If the session is not authenticated, then the provider WILL BE called.

### IAnalyticalBackend.currentUser()

Returns a service for interacting with the currently authenticated user.

**Signature:**

```typescript
currentUser(): IUserService;
```
**Returns:**

[IUserService](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iuserservice/index.md)

an instance that can be used to interact with the user

### IAnalyticalBackend.dataSources()

Returns service that can be used to work with data sources.

**Signature:**

```typescript
dataSources(): IDataSourcesService;
```
**Returns:**

[IDataSourcesService](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.idatasourcesservice/index.md)

### IAnalyticalBackend.deauthenticate()

Triggers deauthentication process against the backend.

**Signature:**

```typescript
deauthenticate(returnTo?: string): Promise<void>;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| returnTo | string | _(Optional)_ url to redirect after successful relogin |

**Returns:**

Promise&lt;void&gt;

promise of the completed process, or rejection if deauthentication failed.

### IAnalyticalBackend.entitlements()

Returns service that can be used to obtain license entitlements.

**Signature:**

```typescript
entitlements(): IEntitlements;
```
**Returns:**

[IEntitlements](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ientitlements/index.md)

### IAnalyticalBackend.geo()

Returns service that can be used to load geo location assets.

**Signature:**

```typescript
geo(): IGeoService;
```
**Returns:**

[IGeoService](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.igeoservice/index.md)

### IAnalyticalBackend.isAuthenticated()

Tests authentication against this backend.

**Signature:**

```typescript
isAuthenticated(): Promise<IAuthenticatedPrincipal | null>;
```
**Returns:**

Promise&lt;[IAuthenticatedPrincipal](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iauthenticatedprincipal/index.md) &#124; null&gt;

promise of authenticated principal is returned if authenticated, null is returned if not authenticated.

#### Remarks

This requires network communication and is thus asynchronous. If the current backend (or session it lives in) is not authenticated, then this method MUST NOT call the authentication provider.

### IAnalyticalBackend.onHostname()

Creates new instance of backend on the provided hostname.

**Signature:**

```typescript
onHostname(hostname: string): IAnalyticalBackend;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| hostname | string | host[:port] |

**Returns:**

[IAnalyticalBackend](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md)

new, unauthenticated instance

#### Remarks

It is valid NOT TO specify any hostname, in which case the analytical backend assumes it should communicate with the current origin.

### IAnalyticalBackend.organization()

Returns an organization available on the backend.

**Signature:**

```typescript
organization(organizationId: string): IOrganization;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| organizationId | string | unique ID of the organization |

**Returns:**

[IOrganization](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iorganization/index.md)

### IAnalyticalBackend.organizations()

Returns a service that can be obtained to obtain organizations.

**Signature:**

```typescript
organizations(): IOrganizations;
```
**Returns:**

[IOrganizations](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iorganizations/index.md)

### IAnalyticalBackend.withAuthentication()

Sets authentication provider to be used when backend discovers current session is not authenticated.

**Signature:**

```typescript
withAuthentication(provider: IAuthenticationProvider): IAnalyticalBackend;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| provider | [IAuthenticationProvider](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iauthenticationprovider/index.md) | authentication provider to use |

**Returns:**

[IAnalyticalBackend](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md)

a new instance of backend, set up with the provider

### IAnalyticalBackend.withCorrelation()

Sets request correlation metadata that will be included in HTTP requests to the backend. If the [IAnalyticalBackend](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md) instance already has correlation metadata set, the new metadata will be merged with the existing one. This method provides more flexibility than withTelemetry by allowing arbitrary key-value pairs to be sent.

**Signature:**

```typescript
withCorrelation(correlationMetadata: IRequestCorrelationMetadata): IAnalyticalBackend;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| correlationMetadata | [IRequestCorrelationMetadata](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.irequestcorrelationmetadata/index.md) | key-value pairs to include as correlation metadata |

**Returns:**

[IAnalyticalBackend](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md)

a new instance of backend configured with the merged correlation metadata

### IAnalyticalBackend.withTelemetry()

Sets telemetry information that SHOULD be sent to backend to track component usage.

**Signature:**

```typescript
withTelemetry(componentName: string, props: object): IAnalyticalBackend;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| componentName | string | name of component |
| props | object | props |

**Returns:**

[IAnalyticalBackend](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md)

a new instance of backend, set up with the provided telemetry

### IAnalyticalBackend.workspace()

Returns an analytical workspace available on this backend.

**Signature:**

```typescript
workspace(id: string): IAnalyticalWorkspace;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| id | string | identifier of the workspace |

**Returns:**

[IAnalyticalWorkspace](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalworkspace/index.md)

an instance that can be used to interact with the workspace

### IAnalyticalBackend.workspaces()

Returns service that can be used to obtain available workspaces.

**Signature:**

```typescript
workspaces(): IWorkspacesQueryFactory;
```
**Returns:**

[IWorkspacesQueryFactory](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iworkspacesqueryfactory/index.md)
