Uri.Parts
URIParses an absolute URI into a record of its component parts.
Syntax
Uri.Parts(absoluteUri as text) as recordParameters
| Name | Type | Required | Description |
|---|---|---|---|
absoluteUri | text | Yes | The absolute URI to parse. |
Return Value
record — A record containing the URI components: Scheme, Host, Port, Path, Query, Fragment, and more.
Remarks
Uri.Parts breaks an absolute URI into its components and returns them as a record with the following fields:
| Field | Type | Description |
|---|---|---|
| Scheme | text | The protocol (e.g., "https"). |
| Host | text | The hostname (e.g., "www.example.com"). |
| Port | number | The port number (e.g., 443). |
| Path | text | The path segment (e.g., "/api/data"). |
| Query | record | Query string parameters as a record (e.g., [page = "1"]). |
| Fragment | text | The fragment identifier after #. |
This function is useful for extracting specific parts of URLs stored in your data — for example, pulling the domain from a list of web addresses, or extracting query-string parameters.
Examples
Example 1: Parse a URL into components
let
Url = "https://api.example.com:8080/data/items?category=electronics&page=2",
Parts = Uri.Parts(Url)
in
#table(
{"Component", "Value"},
{
{"Scheme", Parts[Scheme]},
{"Host", Parts[Host]},
{"Port", Text.From(Parts[Port])},
{"Path", Parts[Path]}
}
)Component | Value | |
|---|---|---|
| 1 | Scheme | https |
| 2 | Host | api.example.com |
| 3 | Port | 8080 |
| 4 | Path | /data/items |
Example 2: Extract domain from URLs in a table
let
Source = #table({"Page"}, {{"https://shop.example.com/products/123"}, {"https://blog.example.com/posts/hello"}}),
Added = Table.AddColumn(Source, "Domain", each Uri.Parts([Page])[Host], type text)
in
AddedPage | Domain | |
|---|---|---|
| 1 | https://shop.example.com/products/123 | shop.example.com |
| 2 | https://blog.example.com/posts/hello | blog.example.com |