Forum Discussion
Connect to Confluence (Atlassian)
Hi japolo - sorry my instruction were unclear. I didn't mean to swap the order of the Web and Json functions.
I have update my example to show you how the Web.Page function should work instead of the Json.Document function:
In my original example, I am connecting to the Rest API, so the result is a JSON file. The last step will work, while the Web.Page fails. I split the steps up to show this. I also added an extra step to show "Text" string included in the JSON file.
I suspect your Web.Contents using the updated #"Relative Path" step return HTML format instead of JSON. So, #"Web Page" step will work, while the #"Json Document" step will fail.
If both are failing, hopefully, the #"View Context Text" will show something meaningful to help us figure out the actual format of the Web Contents. If we still have an error message, you may need to delete the highlighted below.
let
#"Base URL" = "https://your-domain.atlassian.net/",
#"Relative Path" = "wiki/rest/api/user/current",
#"Get Contents" =
Web.Contents(#"Base URL",
[
RelativePath=#"Relative Path",
Headers=[Accept="application/json"] //delete this row
]
),
#"View Content Text" = Text.FromBinary(#"Get Contents"),
#"Web Page" = Web.Page(#"Get Contents"),
#"Json Document" = Json.Document( #"Get Contents")
in
#"Json Document"
- japolo4 years agoFrequent Visitor
Hi,
Thank you for such thorough explanations.
Unfortunately I can't make it work. I have tried to both remove and leave the row you suggested to delete and none worked, instead it returns the error message that the expected type isn't HTML. I also tried switching the last 2 steps from "Get Contents" to the previous step.
And authorization wise, I'm using the generated token from Atlassian together with the e-mail I use in Confluence & Power BI through Basic Authentication
- Anonymous4 years agoNot applicable
japolo - Can I check that you are getting a result when you run it for the API?
"wiki/rest/api/user/current"Do you know that you can preview each of the "Applied Steps" in Power Query. What you can do is switch between the each step in the below to see when the error occurs.
Actually meant this:let #"Base URL" = "https://your-domain.atlassian.net/", #"Relative Path" = "wiki/rest/api/user/current", #"Get Contents" = Web.Contents(#"Base URL", [ RelativePath=#"Relative Path", Headers=[Accept="application/json"] //delete this row ] ), #"View Content Text" = Text.FromBinary(#"Get Contents"), #"Web Page" = Web.Page(#"Get Contents") in #"Web Page"I think you need to stop using the Json.Document step.
- japolo4 years agoFrequent Visitor
Hi,
Yes, i've tested the different steps. The base URL and Relative Path returns what has already been added after the "=" symbol.
Testing the Get Content Step returns the base URL with the web symbol:
The View Content step returns the HTML code:
The Web page step prompts me to sign in with credentials. I use my e-mail and the created token in atlassian but it tells me the credentials are invalid so I guess the problem starts here. I've tried the "normal" name I have there as well and all kinds of other usernames and passwords as well but none works. Should it not be the username/e-mail with the created token? And i'm using the Basic one.
And the last step prompts that an error reason could be invalid credentials.