Copy link to clipboard
Copied
I'm sorry I'm coming to the forum for help - especially with as much help as I need. I've always used CF in a single environment never having done API's. I now have a need to get data off of a server and I can't figure this out. I've been scouring forums and found nothing. The company I am dealing with doesn't know anyone using CF. Here is their information:
This API allows external systems to request a report and provides an endpoint to check for the status of the report's completion. Once completed, the contents of the report can be downloaded as a CSV file. The flow for using the reports API is simple: send an HTTP POST request containing a JSON-formatted payload the metadata on what kind of report to run and what kinds of columns to include and what to filter by. If successful, the response will contain the URL to poll for the status of the report that will be generated. Poll this URL until it shows a completed status and a URL where the final CSV file is located.
You can make the HTTP request using any HTTP client you want, but the simplest would be to use the "curl" command. The curl request will look like this, substituting the underlined parts for the appropriate values:
curl -i -X POST --user "YOUR_USERNAME:YOUR_PASSWORD" \
https://servername.com/api/reports/report_runs \
-H 'Content-Type: application/json' \
-d '{ ... }'
Explanation: The -i flag will print the response header out, which will contain a header named Location to poll for the status of the report. The -X POST flag specifies the request method of POST which is necessary to append a payload. The --user "YOUR_USERNAME:YOUR_PASSWORD" flag specifies that the request will use basic authentication which will transmit the username and password, separated by a colon (:) character, in base 64 encoding. The -H "Content-Type: application/json" flag specifies that the payload is in JSON format, then the -d "{...}" flag specifies the actual payload. The payload is explained below. Finally, the URL is at the end of the command - ensure that the domain matches whatever domain you are using to access the application (e.g. https://servername.com/api/reports/report_runs).
The payload is a JSON object structured as follows:
{ "report": "customer_report",
"columns": ["customer_id", "customer_name" ],
"filters": [ { "column": 'project_id', "operator": "=", "threshold": 2059877 } ] }
I would really appreciate any help you can offer.
THANKS!!!
Have something to add?