Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Pass Postcodes to ofcom API

Hi All,   Fairly new to PowerBI so bear with me.   Ihave a list of Postcodes i want to pass to the ofcom api to check thier broadband speed. I created a function as below   let get_speed = (#...
  • PhilipTreacy's avatar
    5 years ago

    HI Anonymous 

    Download this PBIX file with code - just enter your API key.

    I signed up for an OfCom API key to test this.  This code is tested and working.  The Post Code has to be in upper case and without spaces e.g. E146NJ

    (PostCode as text) =>
    
        let
            Source = Json.Document(
                
                        Web.Contents(
                
                            "https://api-proxy.ofcom.org.uk/broadband/coverage/"&Text.Replace(Text.Upper(PostCode), " ", ""), 
                        
                            [Headers=[#"Ocp-Apim-Subscription-Key"="xxxxxx", Name="api-proxy.ofcom.org.uk"]])),
    
            Availability = Source[Availability]
        in
            Availability

    If you start with a column of post codes, the API will return a list of records for each house in that post code

     

    You can expand these lists to get the records and then expand those records

     

    Regards

    Phil


    If I answered your question please mark my post as the solution.
    If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.