Forum Discussion
can't save dataflow one or more entities references a dynamic data source site
Dataflows requires the first parameter of `Web.Contents` to be a base url that contains only the domain name (host) or scheme and domain name. In your case, the host is `test.test.com` and the scheme is `https`. It would look like so:
let
Source = Web.Contents("https://test.test.com")
in
Source
Because you're requesting data from an API endpoint that requires pagination, you've set up your requests in a way that dynamically changes the url of each each request. Again, Dataflows requires the base url of the `Web.Contents` function to be static.
In other words, you'll need to set explicitly both the base and relative path of the url and programatically update its query parameters for each request.
Gvien that `test.test` is not a real API, there's no way for me provide testable code. But this should get you on your way:
let
PageCount = 201,
PageIndices = {1 .. PageCount-1},
EntitiesPerPage = 100,
GetPage = (Index) =>
let
request = getRequest(Index),
jsonResponse = Json.Document(request),
data = jsonResponse[data]
in
data,
getRequest = (pageNumber as any) => Web.Contents(
"https://test.test.com",
[
Headers = [
],
Query = [
order_by = "created_at",
include = "stats",
per_page = "100",
page = Text.From(pageNumber)
],
RelativePath = "/api/v2/tickets"
]
),
Pages = List.Transform(PageIndices, each GetPage(_))
in
Pages