I am able to successfully use the Confluence API to read the contents of a page. For a page that has an embedded image, I understand that it is saved in Confluence as an attachment and I’m able to get the URL of the attachment.
My code below, assuming json.results contains all the attachments for a page
I am using a stand-alone C# desktop application, so whilst running Jira and Confluence API calls, I use Basic authentication with 64 bit encoded email address / API token - this has worked successfully for ages.
I’m unsure how to authenticate when getting the attachments because it isn’t an API call.
The code I showed above is not the same as what I use to read the contents of a Confluence page, but I discovered that using the same code works if I read the output directly into a byte array, as opposed to a string, so the code looks like this