Hi @ShaharP ,
Here is a simple Python code block, you will note that this includes all of the types to export and that the forecast ID is not set, as this will be unique to your environment, as will the be the API Key:
import requests
url = "https://api.clari.com/v4/export/forecast/<forecast_name>"
payload = "{\n \"timePeriod\": \"2020_Q3\",\n \"typesToExport\": [\n \"forecast\",\n \"quota\",\n \"forecast_updated\",\n \"adjustment\",\n \"crm_total\",\n \"crm_closed,\n ],\n \"currency\": \"USD\",\n \"schedule\": \"NONE\",\n \"includeHistorical\": false,\n \"exportFormat\": \"CSV\"\n}"
headers = {
'Content-Type': 'text/plain',
'apikey': '<api_key>'
}
exportresponse = requests.request("POST", url, headers=headers, data=payload)
print(exportresponse.text)
This code generates the request, you can pull a list of jobs running or completed with the following code block:
import requests
url = "https://api.clari.com/v4/export/jobs"
payload = {}
headers = {
'apikey': '<api_Key>'
}
jobresponse = requests.request("GET", url, headers=headers, data=payload)
print(jobresponse.text)
Finally, to pull the results for your export job, you can take the ID from the list, or from the ID returned by the initial code block:
import requests
url = "https://api.clari.com/v4/export/jobs/<job_id>/results"
payload = {}
headers = {
'apikey': '<api_key>'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
Steve Overton - Sr Technical Support Engineer - Clari