本文介绍了将 Salesforce 报表导出为 CSV (Java)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试自动将 Salesforce 报告导出为 CSV,到目前为止我已经设法在 Salesforce API 中进行了身份验证,但是我找不到任何有关如何将 Salesforce 报告导出为 CSV 或任何其他格式的正确文档这样做的例子.

I'm trying to automatise the exporting of Salesforce Reports as CSV's, so far I've managed to authenticate in the Salesforce API but I couldn't find any proper documentation on how to export the Salesforce Reports as CSV's or any other examples of doing it.

我知道有可能无法完成,但您仍然可以将其导出为 JSON 并使用库将其转换为 CSV,尽管我没有找到任何内容.

I've understood that there is a chance that could not be done, but you can still export it as a JSON and convert it to a CSV using a library, although I didn't find anything.

推荐答案

如果您通过了身份验证(获得了会话 ID),那么您就大功告成了.

If you're authenticated (got session id back) you're almost there.

hacky,未得到官方支持的方法是向报表导出发送 GET 请求,就像用户单击按钮一样.查看如何直接从 Salesforce Lightning 下载 CSV 格式的报告?Salesforce:通过 R 中的 URL 下载报告 示例(不是 Java,但原理相同).您必须发送使用 sid=sesionidgoeshere 设置 cookie 的标头.

The hacky, not officially supported way is to send a GET request to the report export just like user would click a button. Check out How to download a report as a CSV directly from Salesforce Lightning? or Salesforce: Download Reports via URL in R examples (it's not Java but same principle). You'd have to send header that sets cookie with sid=sesionidgoeshere.

更官方的方法是使用 报告 API

这篇关于将 Salesforce 报表导出为 CSV (Java)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 06:54