Url
The url API
Section titled “The url API”uHeadless allows you to get a page by it’s url. This allows you to create dynamic routing to your content in uHeadless.
Options
Section titled “Options”This resource has these properties
| Property | Default | Type | Description |
|---|---|---|---|
| breadcrumb | false | boolean | Include the breadcrumb property in the document result. |
| depth | 2 | number | The depth of relations to include in the response. |
| domain | string | Scope the results to a specified hostname define under “Culture and hostnames” in Umbraco. |
How to use
Section titled “How to use”const url = new URL(`https://api.uheadless.com/url/${path}`)
url.searchParams.set('token', UHEADLESS_API_KEY)url.searchParams.set('domain', 'example.com')
const request = new Request(url)
const doc = await fetch(request) .then((res) => { if (!res.ok()) { throw new Error('Document could not be found', { cause: res.status }) }
return res }) .then(res => res.json())