繁体   English   中英

累积文件存储库

[英]Cumulocity File Repository

我正在尝试在 Cumulocity -> Administration -> Management -> File Repository 中加载 csv 文件。 我的目标是访问 HTML 小部件中的文件内容,并以表格或图表格式显示数据。 我尝试使用 fetch() 方法来使用 csv 文件 url,但它无法获取该文件。 我相信该文件现在已本地存储到 Cumulocity 平台中。 如何通过 fetch() 访问文件。

您正试图滥用 HTML 小部件来实现它不是为它设计的东西。

与其将这样的逻辑破解到 HTML 小部件中,您应该使用自己的小部件扩展 Cockpit 应用程序,老实说,使用 WebSDK 并不难。 https://cumulocity.com/guides/web/introduction/

There is a XSRF protection to prevent exactly what you are currently trying: Bringing in custom javascript code into the live application and trying to access the platform API by "hijacking" the cookies of the logged in user (and you would either need the cookies or硬编码一些凭据,因为您无法访问未经身份验证的 API)。

如果您使用 SDK,甚至还有一个适当的 Angular 服务来获取 API 的文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM