# HttpDataSource Class

> HttpDataSource class in the TX Sheet Control .NET API: Optional HTTP tabular-feed adapter, including OData value arrays.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Class
- **Namespace:** `TXTextControl.TXSheetControl.Data`
- **Package:** `TXTextControl.TXSheetControl.Server` (assembly `TXTextControl.TXSheetControl.Data.Http.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Implements:** `TXTextControl.TXSheetControl.Data.IDataSource`
- **Path:** TX Sheet Control > API Reference > .NET API > TXTextControl.TXSheetControl.Data > HttpDataSource Class
- **1312 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/httpdatasource/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/httpdatasource/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/httpdatasource/llms-full.txt

---

Optional HTTP tabular-feed adapter, including OData value arrays. Authentication, fixed URL and paging are configured by a server request factory. Client lifetime is owned by the application / IHttpClientFactory.

### Syntax

```csharp
public class HttpDataSource
```

Interfaces: `IDataSource`.

### Members

#### Constructors

| Constructor | Description |
|---|---|
| [Constructor](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/httpdatasource/constructor/llms-full.txt) | Creates a feed adapter. Optional column names make empty object-array responses well-defined. Factory must return a new owned request and map Offset/Limit to the remote service's query contract. |

#### Properties

| Property | Description |
|---|---|
| [Capabilities](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/httpdatasource/capabilities-property/llms-full.txt) | Request parameters and paging are mapped by the application's request factory. |

#### Methods

| Method | Description |
|---|---|
| [QueryAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/httpdatasource/queryasync-method/llms-full.txt) | Reads at most 16 MiB. Accepts {columns,rows}, an object array or an OData {value:\[...\]} envelope. Nested values are rejected. Remote next links are never followed implicitly. |

### Examples

Create a working report from bounded HTTP sales data. Supply an application-owned HttpClient and service URL; scope cached data to its actual audience.

```csharp
using System.Net.Http;
using TXTextControl.TXSheetControl.Data;
using TXTextControl.TXSheetControl.Server;

async Task<byte[]> BuildHttpDataSourceExampleAsync(ServerSheetControl control, HttpClient client, Uri serviceBase)
{
    var book = control.Workbook;
    var sheet = await book.Sheets.AtAsync(0);
    var source = new HttpDataSource(client, request => new HttpRequestMessage(HttpMethod.Get, new Uri(serviceBase, "sales?offset=" + request.Offset + "&limit=" + request.Limit)), ["Region", "Revenue"]);
    var registry = new DataSourceRegistry();
    registry.Register("sales-service", "regional-sales", source);

    var request = new DataRequest { Offset = 0, Limit = 100, Parameters = new Dictionary<string, object?> { ["year"] = 2026 } };
    var options = new DataQueryOptions { Timeout = TimeSpan.FromSeconds(15), CacheDuration = TimeSpan.FromMinutes(1), CacheScope = "public-regional-sales" };
    using var binding = new WorkbookDataBinding(book, registry);
    await binding.RefreshRangeAsync(sheet.Range("A1:B101"), "sales-service", "regional-sales", request, options);
    await sheet.Range("A1:B1").FormatAsync(new { fontFamily = "Liberation Sans", fontSize = 16, bold = true, textColor = "#ffffff", fillColor = "#163b63" });
    return await control.SaveAsync(StreamType.PDF);
}
```

### See Also

- [TXTextControl.TXSheetControl.Data Namespace](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/llms-full.txt)
- [Workbooks and Worksheets](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/workbooks/llms-full.txt)

---

## In This Section

- [HttpDataSource.Capabilities Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/httpdatasource/capabilities-property/llms-full.txt): HttpDataSource.Capabilities property in the TX Sheet Control .NET API: Request parameters and paging are mapped by the application's request factory.
- [HttpDataSource Constructor](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/httpdatasource/constructor/llms-full.txt): HttpDataSource constructor in the TX Sheet Control .NET API: Creates a feed adapter. Optional column names make empty object-array responses well-defined.
- [HttpDataSource.QueryAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/httpdatasource/queryasync-method/llms-full.txt): HttpDataSource.QueryAsync method in the TX Sheet Control .NET API: Reads at most 16 MiB. Includes the syntax and a C# example.

---

## Nearby

- **Previous:** [DataSourceRegistry.Remove Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/datasourceregistry/remove-method/llms-full.txt)
- **Next:** [HttpDataSource Constructor](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/httpdatasource/constructor/llms-full.txt)
