Creating a template

Sree
Sree Expensify Customer Posts: 3

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'


Tagged:

Best Answer

  • Francois Laithier
    Francois Laithier Expensify Team Posts: 33 Expensify Team
    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 file expensify_template.ftl, URL-encode it, and pass it in the request under the name template.

    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