"No Template Submitted" response from API???

I've searched the forum here but can't find a solution to this problem. This seems like it must be pretty basic but it's stumping me. I’m working on a script to interact with an API and I’m using curl on a Linux box because the API documentation is written with curl as the example scripting language. The part I’m having trouble with is passing in my “report template” as one of the parameters.
I'm just trying to get a basic "hello world" type call going for starters so I'm using the exact example from the API documentation:
--data-urlencode 'template@expensify_template.ftl'
That’s the piece that doesn’t seem to be working because the API responds with:
{"responseMessage":"No Template Submitted","responseCode":410}create: line 21: --data-urlencode: not found
My template file is in the same directory as the curl script and its named expensify_template.ftl.
Why is it telling me I didn't submit a template when I actually did (or so it appears to me)?
Best Answer
-
Hi there,
The part
create: line 21: --data-urlencode: not found
suggests that the--data-urlencode
instruction is not part of yourcurl
command. If you wrote that instruction on a separate line, make sure to add\
at the end of the previous line, like this:curl -X POST 'https://integrations.expensify.com/.....' \ -d 'requestJobDescrption={...}' \ --data-urlencode 'template@expensify_template.ftl'
If that still doesn't work, try to replace the
@
operator (which tells curl to read the content of the specified file) with a value directly, e.g.:--data-urlencode 'template=hello%20world
Answers
-
Yes! That worked. I'm really scratching my head wondering why that critical bit was left out of the example code in the Expensify API documentation examples.
-
Sheena Trepanier Expensify Team, Approved! Accountant, Expensify Student Ambassador Posts: 1,362 Expensify Team
Thanks for letting us know that worked! I'll circle back with my team about updating the documentation.
Cheers!