//native
/**
* Update Page
* Update a website page or landing page. Only the fields you pass change. Requires the content scope.
*/
export async function main(
auth: RT.Hubspot,
page_type: "site-pages" | "landing-pages",
page_id: string,
body: { [key: string]: any }
) {
const url = new URL(
`https://api.hubapi.com/cms/v3/pages/${page_type}/${page_id}`
)
const response = await fetch(url, {
method: "PATCH",
headers: {
Authorization: `Bearer ${auth.token}`,
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify(body),
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 5 hours ago