Attaching a file via RestAPI to a Confluence page draft

@PhilipFeldmann I do this. Not sure if there’s any better method…

const draftStatus= () =>
  new Promise((resolve) => {
    AP.navigator.getLocation((location) => {
      const contentId = location.context.contentId
      AP.request({
        url: `/rest/api/content/${contentId}`,
      })
        .then(() => resolve({ id: contentId, status: 'current' }))
        .catch(() => resolve({ id: contentId, status: 'draft' }))
    })
  })
2 Likes