0
0
Power BIbi_tool~10 mins

OData and REST API connections in Power BI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to connect Power BI to an OData feed URL.

Power BI
let
    Source = OData.Feed("[1]")
in
    Source
Drag options to blanks, or click blank then click option'
Ahttp://localhost:8080/api/data
BC:/Users/Documents/data.csv
Cftp://example.com/data
Dhttps://services.odata.org/V4/OData/OData.svc/
Attempts:
3 left
💡 Hint
Common Mistakes
Using a local file path instead of a URL.
Using an FTP URL which is not supported by OData.Feed.
Using a REST API URL that is not an OData service.
2fill in blank
medium

Complete the code to add HTTP headers when connecting to a REST API in Power BI.

Power BI
let
    Source = Json.Document(Web.Contents("https://api.example.com/data", [Headers=[[1]]]))
in
    Source
Drag options to blanks, or click blank then click option'
A#"Authorization" = "Bearer token123"
B[Authorization = "Bearer token123"]
C#"Content-Type" = "application/json"
D[Content-Type = "application/json"]
Attempts:
3 left
💡 Hint
Common Mistakes
Using curly braces {} instead of square brackets [] for headers.
Using colon instead of equals sign for key-value pairs.
Passing headers as a list instead of a record.
3fill in blank
hard

Fix the error in the Power Query code to correctly parse JSON from a REST API.

Power BI
let
    Source = Web.Contents("https://api.example.com/data"),
    JsonData = Json.Document([1])
in
    JsonData
Drag options to blanks, or click blank then click option'
ASource()
BJson.Document
CSource
DWeb.Contents
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the function Web.Contents instead of its result.
Calling Source as a function with parentheses.
Passing Json.Document inside itself.
4fill in blank
hard

Fill both blanks to filter OData feed data for products with Price greater than 100.

Power BI
let
    Source = OData.Feed("https://services.odata.org/V4/OData/OData.svc/"),
    Filtered = Table.SelectRows(Source, each [1] > [2])
in
    Filtered
Drag options to blanks, or click blank then click option'
A[Price]
B100
C50
D[Quantity]
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong column name like Quantity.
Using a smaller number like 50 instead of 100.
Not using square brackets around the column name.
5fill in blank
hard

Fill all three blanks to create a custom header and query parameter for a REST API call in Power BI.

Power BI
let
    Source = Web.Contents(
        "https://api.example.com/data",
        [
            Headers = [[1]],
            Query = [[2] = [3]]
        ]
    )
in
    Source
Drag options to blanks, or click blank then click option'
A#"Authorization" = "Bearer abc123"
Bfilter
C"status eq 'active'"
D#"Content-Type" = "application/json"
Attempts:
3 left
💡 Hint
Common Mistakes
Using curly braces {} instead of square brackets [] for headers.
Not quoting the query parameter key and value correctly.
Mixing up headers and query parameters.