问题
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.
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.
回答1:
If you're authenticated (got session id back) you're almost there.
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
.
The more official way would be to use the reporting API
来源:https://stackoverflow.com/questions/57744426/export-salesforce-reports-as-csv-java