//body is a variable where are stored information that will be sent on request
let body = "{
""username"": " & tokenUserName & ",
""password"": " & tokenPassword & "
}",
//getToken is a function it was created to make the request
getToken = Json.Document(
Web.Contents(
//tokenAddress is the variable where the address tokes was set
tokenAddress,
//In content, the body variable is inserted with all information needed
[
Headers = [#"Content-Type"= "application/json"], //Required by documentation
Content = Text.ToBinary(body)]
)
),
token = getToken[idToken],
//----
authToken = "bearer " & token, //Required by documentation.
//Note, bearer needed to be inserted together with the token
getReturn = Json.Document(
Web.Contents(
urlRequest, //Request address
[Headers=[Authorization=authToken]] //Required by documentation
)
)
in getReturn