Interface
One Endpoint and Many Queries - Working with the Bureau of Economic Analysis API
The US BEA provides some of the arguably most important data in the country. It powers the lion’s share of financial visuals you see in publications such as The New York Times, Wall Street Journal and The Economist. And, of course, the blogs.
The information is critical to policymakers, economists, and anyone shaping a narrative. You’d think the data source would be easy to work with, given the gravity and audience. Not exactly the case, and it starts with how the service fundamentally works.
A typical API uses paths and structure. Parameters are scoped to each endpoint path. Simple. Nice. You send a request to this path, and the parameters act as filter criteria.
The BEA doesn’t exactly work that way. There are no clean paths to call when retrieving economic datasets. Instead, the service expects you to build the request yourself, submitting everything as a query string to a single endpoint: GetData.
Further, each dataset comes with its own set of parameters. Some are required, others optional, but the rules depend on the DataSetName you’re working with. In other words, there’s a rotating cast of dataset-specific parameters that shift from one request to the next.
The result: a method and a variable set of parameters must be stitched together to form a valid request.
So, it’s a bit of a Frankenstein, this thing. Assembled from different parts and walking tall out there. Now, how do we know the parameters each dataset requires?
The Bureau of Economic Analysis API: simply different…or a diva? Either way, we’ve got to get a little fancy when submitting requests to the BEA API otherwise the data doesn’t flow, and we don’t get those lovely charts in the papers.
To make this work in a service such as Power Platform, this is where policy templates come in, specifically the Route Request option.
Using a policy in a custom connector, the connector constructs the query on the fly, injects the parameters specified for each dataset in the definition file, then sends everything as a request to a single endpoint.
Set the host and basePath in the apiDefinition file:
Specify parameters like any other action:
Set the policy:
That one endpoint supports many queries for the 13 datasets offered by the BEA, parameters included.
And that’s how the print and digital media folks put together those snazzy financial visuals using BEA information. You don’t call endpoints; you’re composing requests.
Look at you. All fancy now!
/**/
This is a new GitHub pull request in the Microsoft Power Platform Independent Publishers area. Feel free to follow the journey from initial pull request to global deployment on the MS Learn connectors page.













