Forum Discussion

Mitchblue006's avatar
Mitchblue006
Advocate I
3 years ago
Solved

List Generate in advanced editor

Hi everyone   I am receiving errors in syntax when I try loop my scroll ID through my base url, I guess I should paste the screenshot, however the error seems to be at the end...     each [data] ...
  • PhilipTreacy's avatar
    3 years ago

    Hi Mitchblue006 

     

    Authorization should be sent as part of a Headers record e.g.

     

    data= Json.Document(Web.Contents(api_url,
       [ 
         Headers = [#"Authorization"=EncodedCredentials]
       ]
       )
       )

     

    Typically the Auth credentials would be encoded before sending too, something like this

        ClientID = "xxxxxxxx",
        Secret = "xxxxxxxx",
        
        EncodedCredentials = "Basic " & Binary.ToText(Text.ToBinary(ClientID & ":" & Secret), BinaryEncoding.Base64),

     

    Apart from this I don't get any other syntax errors in the code.

     

    This article has info and examples of connecting to an API that requires authentication

     

    Connecting to an OAuth API Like PayPal With Power Query • My Online Training Hub 

     

    regards

     

    Phil