//native
/**
* Update Blog Post Draft
* Update the draft version of a blog post without touching the live version. Publish it with Push Blog Post Draft Live. Requires the content scope.
*/
export async function main(
auth: RT.Hubspot,
blog_post_id: string,
body: { [key: string]: any }
) {
const url = new URL(
`https://api.hubapi.com/cms/v3/blogs/posts/${blog_post_id}/draft`
)
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