Downloader API is returning the Template name and not the file

I'm trying to use the "Report Exporter" and "Downloader" APIs to return report data. However, the downloader API call is only returning the template name and not the actual content of the report. I've attached a screenshot from Postman, and the "Downloader" call is below:
https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations?requestJobDescription={ "type":"download", "credentials":{ "partnerUserID":"USER_ID", "partnerUserSecret":"SECRET" }, "fileName":"export99802ea5-f9a6-415c-bdd7-20bbd73a8230.json", "fileSystem":"integrationServer" }
Thanks in advance for the assistance,
Nicolas DiGiulio
Answers
-
Hey @Nicolas_Dispatch, sorry to hear you're having trouble with exporting via our API! I think the final part of the request is missing from the sample that you sent over, can you send over the --data-urlencode instruction?
That's probably at the end of your request, and might look something like:
--data-urlencode 'template=oracle_export.ftl'
-
Hi @Conor Pendergrast, according to the Downloader APIs there is no --data-urlencode instruction included. There is one included in the Report Exporter APIs, and I'll also attach what my request looks like for that API call.
https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations?requestJobDescription= {"type":"file", "credentials":{ "partnerUserID":"USER_ID", "partnerUserSecret":"SECRET" }, "onReceive":{ "immediateResponse":["returnRandomFileName"] }, "inputSettings":{ "type":"combinedReportData", "filters":{ "reportIDList":"44291481" } }, "outputSettings":{ "fileExtension":"json" }}&template=oracle_export.ftl
Thanks,
Nicolas DiGiulio
-
Hey Nicolas, ah ha - yes, that's exactly what I was looking for! The
template=oracle_export.ftl
element is what we're looking at. Right now, we're defining the template as literally being oracle_export.ftl, rather than the contents of that template.Where is that template stored at the moment?
-
@Christina Draeger created this template for us. Christina, would you be able to answer this question?
-
Hey @Nicolas_Dispatch !
Try your call one more time but change just one tiny bit:
Old:
template=oracle_export.ftl
New:
template@oracle_export.ftl
The
@
operator means "read the content of the file calledoracle_export.ftl
and use it as the parameter calledtemplate
," whereas the=
operator means something more like "call/readoracle_export.ftl
astemplate
."I hope this helps! Please let me know if your call works successfully with this change.
-
Hi @Karisa Caudill,
Thanks for jumping in and helping out. I'm now receiving the following Error Code after I make that update:
{"responseMessage":"No Template Submitted","responseCode":410}
-
@Nicolas_Dispatch Can you attach the full call again so we can take a fresh look since you made those changes?
-
Below is the Report Exporter call that is returning that error message. Thanks for your help!
https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations?requestJobDescription= {"type":"file", "credentials":{ "partnerUserID":"USER", "partnerUserSecret":"SECRET" }, "onReceive":{ "immediateResponse":["returnRandomFileName"] }, "inputSettings":{ "type":"combinedReportData", "filters":{ "reportIDList":"44291481" } }, "outputSettings":{ "fileExtension":"json" }}&template@oracle_export.ftl
-
-
Just wanted to follow-up with you as well as I haven't heard anything since last week.
Thanks.
-
Hi Nicolas,
Our code samples show how to call the API using curl, which I think may have caused some confusion here. Since you're using Postman, you'll want to:
- Change your request type to
POST
- Open the Body tab, select
x-www-form-urlencoded
- Add the two parameters
requestJobDescription
andtemplate
, and their respective values- Note: As far as I know, Postman doesn't support passing request parameters from a file for this type of request, so you'll need to paste the whole template's content in the Value field - not your template's filename
- Use https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations as the request URL. The
requestJobDescription
parameter is already specified as a POST parameter, no need to repeat it here
Best
- Change your request type to
-
@Francois Thanks for the assistance!
@Christina Draeger Could you provide me with the Oracle Export template's content. I believe you custom built this for the client?
Thanks!
-
I have same error
-
I am trying to use the "Report Exporter" and "Downloader" APIs to return report data. However, the downloader API call is only returning the template name and not the actual content of the report.
https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations?requestJobDescription={
"type":"download",
"credentials"{
"partnerUserID":"USER_ID",
"partnerUserSecret":"SECRET"
},
"fileName":"myExporte60a91bd-95f5-439e-aff9-fab16ea937d1.json",
"fileSystem":"integrationServer"
}
May you give me API code for this in PHP.
Or give me solution for it.
Thank you
-
curl -X POST 'https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations' \ -d 'requestJobDescription={ "type":"file", "credentials":{ "partnerUserID":"_REPLACE_", "partnerUserSecret":"_REPLACE_" }, "onReceive":{ "immediateResponse":["returnRandomFileName"] }, "inputSettings":{ "type":"combinedReportData", "reportState":"APPROVED,REIMBURSED", "limit":"10", "filters":{ "startDate":"2016-01-01", "endDate":"2016-02-01", "markedAsExported":"Expensify Export" } }, "outputSettings":{ "fileExtension":"xlsx", "fileBasename":"myExport" }, "onFinish":[ {"actionName":"markAsExported","label":"Expensify Export"}, {"actionName":"email","recipients":"[email protected],fin[email protected]", "message":"Report is ready."} ] }' --data-urlencode 'template@expensify_template.ftl'
I got excel sheet and rows titles which had i passed via template without report data. I am unable to see actual report data.
Please help me.
Thank you
-
I got same value which is i pass via template. Not actual report data
-
API services is only for paid client?
-
@Nicolas_Dispatch did you ever get that file? If not, check your Community message inbox!
@satyamDeveloer thank you for all these details. You can use the API with a free account but the report exporter requires that expenses be attached to a report.
Be sure to replace the generic data points with items that are specific to your account, like the partnerID, partnerSecret, reportState, and action>email>recipient.
I see you have 1 Closed and 1 Reimbursed report. Your call above is only looking for Approved and Reimbursed reports. Please adjust that to Closed and Reimbursed.
"reportState":"APPROVED,REIMBURSED" ---> "reportState":"CLOSED,REIMBURSED"
Please also adjust the email action, it is still pointing to generic example emails.
"actionName":"email","recipients":"[email protected] ---> "actionName":"email","recipients":"[email protected]
Can you try changing the output format from XLSX to CSV to see if you get the expense information to populate? Please let me know how it goes.
-
Thank you for help me. I missed to attached Receipt to Expense. Now i got data in sheet.
I got
Merchant,Original Amount,Category,Project number, Report number,Expense number
7-Eleven,10000,Home Office,1,1
But Original Amount is 100.00 mean 100 only.
One more question, can API return JSON data in a variable. I want to use data in my codes. I don't need to export file. It is possible.
Thank you
-
If i created additional custom input fields for a report. Suppose i created a field with field title Project Number
Then how i got this value via API template.
<#if addHeader == true>
Merchant,Original Amount,Category,Report number,Project number,Expense number<#lt>
</#if>
<#assign reportNumber = 1>
<#assign expenseNumber = 1>
<#list reports as report>
<#list report.transactionList as expense>
${expense.merchant},<#t>
<#-- note: expense.amount prints the original amount only -->
${expense.amount},<#t>
${expense.category},<#t>
${reportNumber},<#t>
${customField.Project_Number},<#t>
${expenseNumber}<#lt>
<#assign expenseNumber = expenseNumber + 1>
</#list>
<#assign reportNumber = reportNumber + 1>
</#list>
-
I got API report data via API. I mansion Original Amount 150, 100, 101, 120, 160, 110.
But it include 00 in last extra.
Actually it is 150.00, 100.00, 101.00, 120.00, 160.00, 110.00
But API miss the point and return 15000, 10000, 10100, 12000, 16000, 11000.
Merchant,Original Amount,Category,Report number,Expense number
7-Eleven,15000,Advertising,1,1
7-Eleven,10000,Home Office,2,2
7-Eleven,10100,Home Office,3,3
7-Eleven,12000,Car,4,4
satyam,16000,Advertising,5,5
7-Eleven,11000,Advertising,7,6
Thank you
-
Hey there, @satyamDeveloer! I'd be happy to help with this!
Per our documentation, the
${expense.amount}
variable will output the original amount of the expense, in cents, which is why your amounts are outputting without a decimal point.I recommend using the following code to introduce the decimal point to the
amount
variable:<#if expense.convertedAmount?has_content> <#assign amount = expense.convertedAmount/100> <#elseif expense.modifiedAmount?has_content> <#assign amount = expense.modifiedAmount/100> <#else> <#assign amount = expense.amount/100> </#if>
From there, just replace
${expense.amount}
with${amount?string("0.00")}
in your template code like this:${expense.merchant},<#t> ${amount?string("0.00")},<#t> ${expense.category},<#t>
... etc.
Can you give that a try and let me know if that works for you?
-
Thank you very much for help me.
-
If i created additional custom input fields for a report. Suppose i created a field with field title Project Number.
Then how i got this value via API template.
<#if addHeader == true>
Merchant,Original Amount,Category,Report number,Project number,Expense number<#lt>
</#if>
<#assign reportNumber = 1>
<#assign expenseNumber = 1>
<#list reports as report>
<#list report.transactionList as expense>
${expense.merchant},<#t>
<#-- note: expense.amount prints the original amount only -->
${expense.amount},<#t>
${expense.category},<#t>
${reportNumber},<#t>
${customField.Project_Number},<#t>
${expenseNumber}<#lt>
<#assign expenseNumber = expenseNumber + 1>
</#list>
<#assign reportNumber = reportNumber + 1>
</#list>
I am trying like this. But i am unable to got custom input fields value.
Thank you.
-
If i created additional custom input fields for a report. Suppose i created a field with field title Project Number.
Then how i got this value via API template.
<#if addHeader == true>
Merchant,Original Amount,Category,Report number,Project number,Expense number<#lt>
</#if>
<#assign reportNumber = 1>
<#assign expenseNumber = 1>
<#list reports as report>
<#list report.transactionList as expense>
${expense.merchant},<#t>
<#-- note: expense.amount prints the original amount only -->
${expense.amount},<#t>
${expense.category},<#t>
${reportNumber},<#t>
${customField.Project_Number},<#t>
${expenseNumber}<#lt>
<#assign expenseNumber = expenseNumber + 1>
</#list>
<#assign reportNumber = reportNumber + 1>
</#list>
I am trying like this. But i am unable to got custom input fields value.
Thank you.
-
@satyamDeveloer Can you help me understand what data you're trying to pull from Expensify to populate the
Project Number
variable? I see that you've created the variable itself, but it doesn't look like you've assigned anything to it.