Calling External APIs to Enrich Your Data
In the previous chapter, you saw an example of how to enrich existing data with external information. In that case, the data was exposed via CSV files, but this is not always the case. Very often, the data that is useful for enrichment is exposed through external application programming interfaces (APIs), most often in the form of web service endpoints. Power BI allows you to read data from a web service through a dedicated UI, but most of the time it is unusable. So, you have to resort to writing M code to get it done. Writing M code isn’t too difficult, but it’s not easy. You also have to be careful not to write code that causes refresh problems when you publish the report to the Power BI service. In addition, Power BI does not allow you to parallelize more than one call to the same web service to reduce latency when retrieving data. Using Python or R to retrieve data from a web service solves all of these issues very easily...