【以下的问题经过翻译处理】 我正在研究如何生成 QuickSight embedded 报告的 url 。我正在尝试使用以下 JAVA 代码以程式的方式设置参数的默认值。但它不起作用。
GetDashboardEmbedUrlRequest req = new GetDashboardEmbedUrlRequest()
.withAwsAccountId(awsAccountId)
.withDashboardId(reportInput.getDashboadId())
.withUserArn(userArn)
.withIdentityType(EmbeddingIdentityType.QUICKSIGHT)
.withSessionLifetimeInMinutes(sessionTimeout);
req.putCustomQueryParameter("CampaignName", "ABC");
req.putCustomQueryParameter("reportDev", "Program");
// get the dashboard URL
String embedUrl = quickSightClient.getDashboardEmbedUrl(req).getEmbedUrl();
LOGGER.info("URL:{}",embedUrl);
在上面的代码中,“CampaingName”是附加到下拉列表里的多值参数。在构建报告时,它的默认值设置为“[All]”。参数“reportDev”是一个单值参数并且没有默认值,也没有控件或任何附加物。我在测试中引入了虚拟参数。
运行代码后,当我复制logger在控制台中输出的 url 并在浏览器中运行时,报告会正确打开,但“CampaignName”和“reportDev”都被设置为了“ALL”。
示例生成的 url 如下
https://xx-xxxx-x.quicksight.aws.amazon.com/embed/xxxxxxxxxxxxxxxxxxxx/dashboards/xxxxxxxxxxxxxxxxxxxxxx?code=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&identityprovider=quicksight&isauthcode=true
但如果我得了dashboard的 url 并将 url 中的参数传递给它,它就可以正常工作。 “CampaignName”设置为“ABC”,“reportDev”设置为“Program”。也根据报告中的数据进行了过滤。Url正常工作,如下所示。
https://xx-xxxx-1.quicksight.aws.amazon.com/embed/xxxxxxxxxxxx/dashboards/xxxxxxxxxxxxxxx#p.reportEnv=Program&p.CampaignName=ABC
谁能告诉我我的代码中缺少什么?我也尝试过以下变量,但没有效果。
req.putCustomQueryParameter("p.CampaignName", "ABC");
req.putCustomQueryParameter("p.reportDev", "Program");