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

# IFactsQuery

- 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/workspace/facts/index.ts

Service to query facts.

**Signature:**

```typescript
export interface IFactsQuery 
```

## Methods

| Method | Description |
| --- | --- |
| [query()](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ifactsquery/index.md#ifactsqueryquery) | Starts the query. |
| [withFilter(filter)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ifactsquery/index.md#ifactsquerywithfilter) | Sets filter for the query. |
| [withInclude(include)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ifactsquery/index.md#ifactsquerywithinclude) | Sets include for the query. |
| [withMethod(method)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ifactsquery/index.md#ifactsquerywithmethod) | **_(BETA)_** Selects which backend endpoint flavor to use when listing facts. Default method: "GET" |
| [withOrigin(origin)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ifactsquery/index.md#ifactsquerywithorigin) | Sets origin for the query. |
| [withPage(page)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ifactsquery/index.md#ifactsquerywithpage) | Sets starting page for the query. Backend WILL return no data if the page is greater than total number of pages. Default page: 0 |
| [withSize(size)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ifactsquery/index.md#ifactsquerywithsize) | Sets number of facts to return per page. Default size: 50 |
| [withSorting(sort)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ifactsquery/index.md#ifactsquerywithsorting) | Sets sorting for the query. |

## Method details

### IFactsQuery.query()

Starts the query.

**Signature:**

```typescript
query(): Promise<IFactsQueryResult>;
```
**Returns:**

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

promise of first page of the results

### IFactsQuery.withFilter()

Sets filter for the query.

**Signature:**

```typescript
withFilter(filter: IFilterBaseOptions): IFactsQuery;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| filter | [IFilterBaseOptions](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ifilterbaseoptions/index.md) | filter to apply |

**Returns:**

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

facts query

### IFactsQuery.withInclude()

Sets include for the query.

**Signature:**

```typescript
withInclude(include: string[]): IFactsQuery;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| include | string[] | include to apply |

**Returns:**

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

facts query

### IFactsQuery.withMethod()

> **Beta API.** Mostly stable, but details may change in a minor release, outside SemVer. See [API maturity](https://www.gooddata.ai/docs/gooddata-ui/latest/integrations/platform/api-maturity/index.md).
> 

Selects which backend endpoint flavor to use when listing facts. Default method: "GET"

**Signature:**

```typescript
withMethod(method: QueryMethod): IFactsQuery;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| method | [QueryMethod](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.querymethod/index.md) | endpoint flavor to use ("GET" or "POST") |

**Returns:**

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

facts query

### IFactsQuery.withOrigin()

Sets origin for the query.

**Signature:**

```typescript
withOrigin(origin: ObjectOrigin | (string & {})): IFactsQuery;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| origin | ObjectOrigin \| (string &amp; {}) | origin to apply. This is an open string union to allow platform-specific origin values in addition to the built-in literals. |

**Returns:**

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

facts query

### IFactsQuery.withPage()

Sets starting page for the query. Backend WILL return no data if the page is greater than total number of pages. Default page: 0

**Signature:**

```typescript
withPage(page: number): IFactsQuery;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| page | number | zero indexed, must be non-negative |

**Returns:**

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

facts query

### IFactsQuery.withSize()

Sets number of facts to return per page. Default size: 50

**Signature:**

```typescript
withSize(size: number): IFactsQuery;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| size | number | desired max number of facts per page must be a positive number |

**Returns:**

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

facts query

### IFactsQuery.withSorting()

Sets sorting for the query.

**Signature:**

```typescript
withSorting(sort: string[]): IFactsQuery;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| sort | string[] | Sorting criteria in the format: property,(asc\|desc). Default sort order is ascending. Multiple sort criteria are supported. |

**Returns:**

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

facts query
