Skip to content

Url

uHeadless allows you to get a page by it’s url. This allows you to create dynamic routing to your content in uHeadless.

This resource has these properties

 PropertyDefault Type Description
breadcrumbfalsebooleanInclude the breadcrumb property in the document result.
depth2numberThe depth of relations to include in the response.
domainstringScope the results to a specified hostname define under “Culture and hostnames” in Umbraco.
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())