Forum Discussion

twilkdaddy's avatar
twilkdaddy
Frequent Visitor
9 years ago

Does Power Query support OPTIONS METHOD?

I am trying to write a query using the OPTIONS method in order to pull URIs for contactIDs in my data set.  However, I cannot find any documentation on how to apply the OPTIONS METHOD to a Web.Contents query.

 

Does anyone know if this is possible and, if not, is there a workaround??

 

See code below:

 

let
Source = Json.Document(Web.Contents("https://ws-use.brightpearl.com/public-api/dude/contact-service/contact/", [Headers=[#"brightpearl-app-ref"="dude_powerbi-1", #"brightpearl-account-token"="GNVf5bK9ihanzifXke3BKkr2vp2fPntxOqJoKAXnsjI=", accept="application/json", #"accept-encoding"="gzip, deflate", #"accept-language"="en-US,en;q=0.8", #"Content-Type"="application/json"],#"Query"="OPTIONS"]))
in
Source

 

 

4 Replies

  • v-ljerr-msft's avatar
    v-ljerr-msft
    Microsoft Employee

    Hi twilkdaddy,

     

    Do you mean passing query parameters with the Query argument of Web.Contents? If that is the case, the code below is for your reference. :smileyhappy:

    let
    Source = Json.Document(Web.Contents("https://ws-use.brightpearl.com/public-api/dude/contact-service/contact/", 
    
    Query = [<insert record here of your query object>],
    
    [Headers=[#"brightpearl-app-ref"="dude_powerbi-1", #"brightpearl-account-token"="GNVf5bK9ihanzifXke3BKkr2vp2fPntxOqJoKAXnsjI=", accept="application/json", #"accept-encoding"="gzip, deflate", #"accept-language"="en-US,en;q=0.8", #"Content-Type"="application/json"]))
    
    in Source

    An example of the Query record might be:

    Query = [#"Argument 1" = "aaa", #"Argument 2" = "bbbb"]

     

    Regards

    • twilkdaddy's avatar
      twilkdaddy
      Frequent Visitor

      Thanks for the reply.  However, maybe I wasn't clear what I'm trying to accomplish.  

       

      In standard web querying, there are GET, POST, DELETE, etc. METHODS you can call for your query.  I'm attempting to call using the OPTIONS method; however, it doesn't look like the Power Query Web.Contents method supports the OPTIONS method.  

       

      Here's an example of what a C# syntax looks like for swithing to OPTIONS METHOD:

       

      myHttpWebRequest.Method = "OPTIONS";

       

      So, I'm wondering if anyone has a workaround in Power BI to allow for writing a query using OPTIONS instead of GET. 

      • v-ljerr-msft's avatar
        v-ljerr-msft
        Microsoft Employee

        Hi twilkdaddy,

         

        Sorry for my misunderstanding.

         

        I don't think the Power Query Web.Contents method supports the OPTIONS method currently. You can add it as an idea on Power BI Ideas to improve Power BI on this feature. :smileyhappy:

         

        Regards