OData.Feed
An OData service: its entity sets to navigate, or one entity set's rows as a table.
Group: Online services. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
OData.Feed(serviceUri as text, optional headers as nullable record, optional options as any) as any
| Parameter | Type | Description |
|---|---|---|
serviceUri | text | The service's address, or an entity set's. |
headers | nullable record optional | Request headers, a field each: [#"Accept-Language" = "nb-NO"]. |
options | any optional | A record: Headers (a record of request headers) and Query (a record of query options, added to the address). |
Returns
any. For a service, a navigation table (Name, Data, Signature, Kind); for an entity set, its rows; for a single entity, a record.
Remarks
- Request headers go in the second argument, a field per header, or in the options' Headers; not in both, which is an error. A header the OData client sets itself, such as Accept, stays its own.
- An entity set is read page by page, following each page's next link (OData 4's @odata.nextLink, OData 3's and the verbose format's too). Annotations such as @odata.etag are not columns.
- Each column gets a type from the values in it: whole numbers Int64.Type, other numbers number, true and false logical, ISO dates and times as dates, datetimes or datetimezones, the rest text; a column whose values are of several kinds is any.
- A service's Kind is "Table" for an entity set, "Record" for a singleton and "Function" for a function import.
- Signed in as each address is for
Web.Contents; the studio asks the first time.
Examples
A service, then one entity set
let
Source = OData.Feed("https://erp.norwayanalytics.no/odata/v4"),
Orders = Source{[Name = "Orders"]}[Data]
in
Orders
Result: not shown here: it needs an OData service and a sign-in.
An entity set, filtered by the service
OData.Feed("https://erp.norwayanalytics.no/odata/v4/Orders", null, [Query = [#"$filter" = "Shop eq 'Oslo'", #"$select" = "OrderId,Amount"]])
Result: not shown here: it needs an OData service and a sign-in.
Names in Norwegian, asked with a header
OData.Feed("https://erp.norwayanalytics.no/odata/v4/Products", [#"Accept-Language" = "nb-NO"])
Result: not shown here: it needs an OData service and a sign-in.
Related functions
Web.Contents, Json.Document, CommonDataService.Database, SharePoint.Tables.