Forum Discussion
Variable in API Call
- 2 years ago
Thank you for all you support it help me understand the code below and how to get it fixed
let
// Laad de tabel
Source = TABLENAME,
// Filter de rijen op de waarde in de TITLE kolom
FilteredTable = Table.SelectRows(Source, each [Table.REPORT_LIST.REPORT.TITLE] = "cel value"),
// Selecteer de eerste rij van de gefilterde tabel
FirstRow = Table.First(FilteredTable),
// Haal de waarde van de ID kolom op
ReportID = Record.Field(FirstRow, "Table.REPORT_LIST.REPORT.ID"),
// Definieer de API URL met de dynamische ID
BaseUrl = "https://qualysapi.qg2.apps.qualys.eu/api/2.0/fo/report/?action=fetch&id=" & Text.From(ReportID),
// Maak de API-aanroep
ApiResponse = Xml.Tables(Web.Contents(BaseUrl, [Headers=[Authorization=QualysToken, #"X-Requested-With"="Detection"]]))
in
ApiResponse
the documentation provides a very specific example exactly for your scenario.
= Xml.Tables(Web.Contents("https://example.com", [RelativePath="fo/report", Query =[action="fetch",id=Text.From(123456)], [Headers=[Authorization="token", #"X-Requested-With"="Detection"]]))
Thank you for all you support it help me understand the code below and how to get it fixed
let
// Laad de tabel
Source = TABLENAME,
// Filter de rijen op de waarde in de TITLE kolom
FilteredTable = Table.SelectRows(Source, each [Table.REPORT_LIST.REPORT.TITLE] = "cel value"),
// Selecteer de eerste rij van de gefilterde tabel
FirstRow = Table.First(FilteredTable),
// Haal de waarde van de ID kolom op
ReportID = Record.Field(FirstRow, "Table.REPORT_LIST.REPORT.ID"),
// Definieer de API URL met de dynamische ID
BaseUrl = "https://qualysapi.qg2.apps.qualys.eu/api/2.0/fo/report/?action=fetch&id=" & Text.From(ReportID),
// Maak de API-aanroep
ApiResponse = Xml.Tables(Web.Contents(BaseUrl, [Headers=[Authorization=QualysToken, #"X-Requested-With"="Detection"]]))
in
ApiResponse