Creating a template

I am trying to run the following command and it is throwing the error "Couldn't read data from file "template@expensify_template.ftl". Wondering where/how can I create the template?
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", "filters":{ "reportIDList":"1234567,2233445" } }, "outputSettings":{ "fileExtension":"csv" } }' \ --data-urlencode 'template@expensify_template.ftl'
Best Answer
-
Hi there,
You can see the curl
@
operator as a useful way to load the content of a parameter to pass in your POST request from a file, instead of putting it directly in the command line. Essentially, the line--data-urlencode 'template@expensify_template.ftl'
will instruct curl to load the content of the fileexpensify_template.ftl
, URL-encode it, and pass it in the request under the nametemplate
.So for this example, you would store your template in a file called
expensify_template.ftl
in the same directory you're making the request from. If you want to store the template in a different directory, you can also specify its relative or absolute path, e.g.--data-urlencode 'template@/path/to/expensify_template.ftl'
.For a quick test, you can use a pre-made sample templates from the documentation.
Answers
-
Thanks you very much. It worked!
I thought, I have to upload template file on to expensify.
-
That's awesome thanks for letting us know 😊
-
Hi I am trying to get all the code sending from google script. I can't figure out how to get the template to work from google drive. this is the code I try but without success:
var exportOptions = {
method: 'post',
payload: 'requestJobDescription=' + encodeURIComponent(JSON.stringify(exportPayload)) +
'&template=' + encodeURIComponent('template@https://drive.google.com/file/d/12345678'),
contentType: 'application/x-www-form-urlencoded'
};
Does anyone have an idea of how to manage this?