Forum Discussion
Custom connector API - TOKEN (error binary)
- 8 months ago
I solved my problem with putting url, header and body in vars and used these in web.contents.
letcreds = Extension.CurrentCredential(),urlToken = Server &"SignIn",HeadersToken = [#"Content-Type" = "application/json",#"api-version" = "1.0"],BodyToken = Json.FromValue([username = creds[Username],password = creds[Password],afm = "",code = ""]),ResponseToken =Web.Contents(url,[Headers = HeadersToken ,Content = BodyToken]),JsonResponseToken = Json.Document(ResponseToken),Token = JsonResponseToken[token]inTokenThank for all your answers!!
Hi Doc-tan,
Thank you for reaching out to the Microsoft fabric community forum.
The problem is happening inside the Power Query custom connector. In Power Query, the response coming from Web.Contents is treated as Binary by default. But later in the code, it’s being read like normal text/JSON. Because of this mismatch, Power Query throws the error saying it can’t convert Binary to Text, and the token is not getting read.
So this is not related to headers, body, or login details. It’s only a response handling issue in the connector. Once the response is properly handled as JSON, you should be able to access the token without any problem.
please go through with the below document hope it may resolve your Issue:
Json.Document - PowerQuery M | Microsoft Learn
Web.Contents - PowerQuery M | Microsoft Learn
Hope the above provided information help you resolve the issue, if you have any further concerns or queries, please feel free to reach out to us.
Regards,
Community Support Team.
Hi Doc-tan,
I hope the information provided above assists you in resolving the issue. If you have any additional questions or concerns, please do not hesitate to contact us. We are here to support you and will be happy to help with any further assistance you may need.
Regards,
Community Support Team.
- Doc-tan8 months agoRegular Visitor
Hello,
I think this Web.Contents - PowerQuery M | Microsoft Learn help me to change my code.- Anonymous8 months agoNot applicable
Hi Doc-tan,
Thank you for sharing the update. If you encounter any problems or have questions after going through the document, feel free to reach out here.
Regards,
Community Support Team.