Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I am trying to pass the list as a paramter in the API.contents() function for which I am creating a parameters function using meta. If I created a single parameter then it works fine but if I am creating a function for multiple parameters I get below error.
What can i do to solve this issue. Any lead would be appreciated.
Code -
section User_API_Param;
[DataSource.Kind="User_API_Param", Publish="User_API_Param.Publish"]
shared User_API_Param.Contents = Value.ReplaceType(parameters, ScopeType);
ScopeType = type function (
message as (type text meta [
Documentation.FieldCaption = "Limit",
Documentation.FieldDescription = "Enter a limit",
Documentation.SampleValues = {"1", "2"}
]),
name as (type list meta [
Documentation.FieldCaption = "limit range",
Documentation.AllowedValues = { "1", "2", "3" }
]))
as any;
parameters = (limit as text, optional limitrange as list) =>
let
accesstoken = Extension.CurrentCredential()[Key],
baseUrl = "https://api.example.com/",
endpoint = "/users",
Headers = [
Authorization = "Bearer " & accesstoken
],
source = Web.Contents(baseUrl,[RelativePath = endpoint & "?limit=" & limit, Headers = Headers, ManualCredentials = true]),
Value = Json.Document(source),
data = Value[data],
ToTable = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
ExpandCol = Table.ExpandRecordColumn(ToTable, "Column1", {"id", "name", "email", "authType", "roles"}, {"id", "name", "email", "authType", "roles"}),
Roles = Table.ExpandListColumn(ExpandCol, "roles"),
RolesData = Table.ExpandRecordColumn(Roles, "roles", {"role"}, {"role"}),
ExtractRoles = Table.ExpandRecordColumn(RolesData, "role", {"id", "name"}, {"id.1", "name.1"}),
RenameRoles = Table.RenameColumns(ExtractRoles,{{"id.1", "Role_id"}, {"name.1", "Role"}})
in
RenameRoles;
// Data Source Kind description
User_API_Param = [
Authentication = [
Key = []
// UsernamePassword = [],
// Windows = [],
// Implicit = []
],
Label = Extension.LoadString("DataSourceLabel")
];
// Data Source UI publishing description
User_API_Param.Publish = [
Beta = true,
Category = "Other",
ButtonText = { Extension.LoadString("ButtonTitle"), Extension.LoadString("ButtonHelp") },
LearnMoreUrl = "https://powerbi.microsoft.com/",
SourceImage = User_API_Param.Icons,
SourceTypeImage = User_API_Param.Icons
];
User_API_Param.Icons = [
Icon16 = { Extension.Contents("User_API_Param16.png"), Extension.Contents("User_API_Param20.png"), Extension.Contents("User_API_Param24.png"), Extension.Contents("User_API_Param32.png") },
Icon32 = { Extension.Contents("User_API_Param32.png"), Extension.Contents("User_API_Param40.png"), Extension.Contents("User_API_Param48.png"), Extension.Contents("User_API_Param64.png") }
];
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
11 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
9 | |
7 | |
6 |