Forum Discussion

stevemccall1's avatar
stevemccall1
Frequent Visitor
3 years ago
Solved

Connecting to a local API via data gateway

Hi,

 

Hope someone can help.  I've set up a local API that is accessible via a data gateway in PowerApps and want to query a dataset against this.  I can't find any documentation on how to do this - is it possible?  If so, can someone point me in the right direction.

 

 

  • lbendlin's avatar
    lbendlin
    3 years ago

    Well, that's not really "local".  How are you planning to do development work?  Running Power BI Desktop on a VM that is in the same subnet?

21 Replies

  • you should be able to use the standard Web.Contents connector.

  • stevemccall1's avatar
    stevemccall1
    Frequent Visitor

    Thanks - Can you give me a bit more info on how to do this please?

    For this API - I will be passing a postcode as a query parameter and getting back coordinates info.  The request looks like this: http://112.220.1.4:8000/postcodes/{postcode} and returns

    {
    "status": 200,
    "result": {
    "postcode": "L1 6DP",
    "quality": 1,
    "eastings": 334623,
    "northings": 390674,
    "country": "England",
    "nhs_ha": "North West",
    "longitude": -2.984936,
    "latitude": 53.408811,
    "european_electoral_region": "North West",
    "primary_care_trust": "Liverpool",
    "region": "North West",
    "lsoa": "Liverpool 060E",
    "msoa": "Liverpool 060",
    "incode": "6DP",
    "outcode": "L1",
    "parliamentary_constituency": "Liverpool, Riverside",
    "admin_district": "Liverpool",
    "parish": "Liverpool, unparished area",
    "admin_county": null,
    "date_of_introduction": "198001",
    "admin_ward": "Central",
    "ced": null,
    "ccg": "NHS Cheshire and Merseyside",
    "nuts": "Liverpool",
    "pfa": "Merseyside",
    "codes": {
    "admin_district": "E08000012",
    "admin_county": "E99999999",
    "admin_ward": "E05000889",
    "parish": "E43000166",
    "parliamentary_constituency": "E14000793",
    "ccg": "E38000101",
    "ccg_id": "99A",
    "ced": "E99999999",
    "nuts": "TLD72",
    "lsoa": "E01033762",
    "msoa": "E02006932",
    "lau2": "E08000012",
    "pfa": "E23000004"
    }
    }
    }

    Ideally - I will be going through a list of data with postcodes and geting back the lat long for each row, so I think will have set up as a function.


      • stevemccall1's avatar
        stevemccall1
        Frequent Visitor

        Hi,

         

        I just get this error:

         

        How do I get PowerQuery to use the data dateway?  The API is only accessible via the gateway.  

         

        For reference - this works fine if I go to a web API 

         


        But I'm unable to use that API for my solution.

  • Adamboer's avatar
    Adamboer
    Responsive Resident

    Yes, it is possible to query a dataset against a local API in PowerApps. Here are the general steps to do so: Create a connection to the local API in PowerApps. You can do this by going to the "Data" tab, selecting "Custom connectors", and then clicking "New custom connector". Follow the prompts to enter the necessary information for the API. Once the connection is established, you can use it to create a data source in PowerApps. In the "Data" tab, select "Add data source" and then select the custom connector you just created. Next, you can use the data source to create a dataset. In the "Data" tab, select "Create" and then select the data source you just added. Finally, you can query the dataset by using the standard PowerApps functions such as Filter, Sort, and Lookup. It's worth noting that the exact steps and functions may vary depending on the specific API and dataset you're working with. You may need to consult additional documentation or seek assistance from a developer familiar with PowerApps and APIs.