We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. 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") }
];
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 10 | |
| 8 | |
| 7 | |
| 7 | |
| 5 |