Secret Power Of Web.Contents PQ Function: Options[Headers] Parameter – Part 4

Web.Contents Parameter tree

This post is about the third most important parameter and that is Headers. We can pass data to a HTTP Call and this is one of them. Basically, we pass metadata in Headers. This is also a key-value parameter and is passed as a record.

And we are going to see only one example of this. Here it goes:

Query + Header Example.pq Code:

let
  Source = Web.Contents(
    "https://api.gateway.attomdata.com/propertyapi/v1.0.0/attomavm/detail", 
    [
      Headers = [apikey = ATTOM_DATA_API_KEY, accept = "application/json"], 
      Query   = [address1 = "1660 Avenida Aviare Unit 4", address2 = "Chula Vista, CA"]
    ]
  ), 
  ConvertedToTable = fxJsonBinaryToTable(Source, true, "|")
in
  ConvertedToTable

If you look into the Headers section then you will see that we are passing two things on that. And both of them is basically metadata of that HTTP Call. One is apikey which is needed for authorization and the second one is accept which is what type of response it is expecting.

Here is the result of that API call.

This is all about Headers. Let me know what do you think.

Leave a Reply

Subscribe to Blog via Email

Enter your email to subscribe to this blog and receive notifications of new posts by email.

You may also like

Please login to Continue Reading