Forum Discussion

clongaw's avatar
clongaw
Frequent Visitor
2 years ago
Solved

How to format Custom Connector with multiple parameters and Authorization Level selection?

I'm trying to create a Custom Connector that connects to an API that needs a Company variable in the header. I have it working where a user can input both a url and a company parameter, but the OAuth...
  • clongaw's avatar
    2 years ago

    I have found the solution to this issue. The code should look like 

     

    [DataSource.Kind="OAuthTest", Publish="OAuthTest.Publish"]
    shared OAuthTest.Contents = Value.ReplaceType(GetDataImpl, GetDataType);
    
    GetDataImpl = (url as text, company as text, optional answer as text) as table=>
    let 
          Data = Xml.Tables(Web.Contents(url, 
            [Headers=#"DefaultHeaders"]))
      in
          Data;
    
    GetDataType = type function (url as Uri.Type, company as text, optional answer as text) as table;