//native
/**
* Get Blog Post Draft
* Retrieve the draft (unpublished) version of a blog post. Requires the content scope.
*/
export async function main(auth: RT.Hubspot, blog_post_id: string) {
const url = new URL(
`https://api.hubapi.com/cms/v3/blogs/posts/${blog_post_id}/draft`
)
const response = await fetch(url, {
headers: {
Authorization: `Bearer ${auth.token}`,
Accept: "application/json",
},
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 5 hours ago