Uploading expenses - Server 500 errors

I started an ‘Idea’ on getsatisfaction.com (http://getsatisfaction.com/
freeagentcentral/topics/
cant_add_batches_of_expenses_from_a_spreadsheet) and have since been
trying to use the API to do a bulk upload of back-dated expenses. As
described in that post, I managed to get CURL to work on my Mac and
managed upload a test expense.

The command I used was as follows:

curl -u ‘email:password’ -H ‘Accept: application/xml’ -H ‘Content-
Type: application/xml’ -d @new_expenses.txt -X POST ‘https://
mycompany.freeagentcentral.com/users/4647/expenses’ -i -v

where the file new-expenses.txt contained the following XML

<?xml version='1.0' encoding='UTF-8'?> 2009-08-02 Test expense Travel -15

Fabulous!

I then parsed the spreadsheet with all my expenses on it and created a
large file with lots of similar XML in it and tried to upload the
expenses as before.

Now, it won’t accept the command, producing instead a 500 server
error.

I’ve reverted to the previous version of the text file but it now
refuses to load the test expense either.

Any help in sorting this out would be much appreciated.

Thanks

DJ

Aarg! Creating lots of little xml files from a spreadsheet is going to
be quite a hill to climb.

Perhaps I can make one CURL line for each one.

Will let you know.

DJOn Aug 3, 10:12 am, Olly o...@freeagentcentral.com wrote:

DJ

It’s not possible to add an array of expenses in the way you are
trying. You will have to add each one via it’s own POST request.

Let me know if you have further problems.

On Aug 2, 1:39 pm, doctordjbrown dj.br...@humancapitalvaluation.com wrote:

Just to add to my last post - it seems to be the XML syntax is the
problem.

I’ve managed to get the single-expense working again - had to cut and
paste the XML code from the FAC API page. Might be my attention to
detail, but I’m wondering if it’s the fact that I’ve got some funny
characters in there.

Anyway, when I duplicate the ‘working’ expense item, so that there are
two of them in the XML file, I return to the 500 Internal Server
Error.

This is the contents of the file I’m trying to post:

<?xml version="1.0" encoding="UTF-8"?> 2008-03-29T Test Expense No 1 Computer Hardware -200.0 17.5 2008-03-29T Test Expense no 2 Travel -100.0 17.5

Anyone able to help with this?

DJ

Just to add to my last post - it seems to be the XML syntax is the
problem.

I’ve managed to get the single-expense working again - had to cut and
paste the XML code from the FAC API page. Might be my attention to
detail, but I’m wondering if it’s the fact that I’ve got some funny
characters in there.

Anyway, when I duplicate the ‘working’ expense item, so that there are
two of them in the XML file, I return to the 500 Internal Server
Error.

This is the contents of the file I’m trying to post:

<?xml version="1.0" encoding="UTF-8"?> 2008-03-29T Test Expense No 1 Computer Hardware -200.0 17.5 2008-03-29T Test Expense no 2 Travel -100.0 17.5

Anyone able to help with this?

DJ

DJ

It’s not possible to add an array of expenses in the way you are
trying. You will have to add each one via it’s own POST request.

Let me know if you have further problems.On Aug 2, 1:39 pm, doctordjbrown dj.br...@humancapitalvaluation.com wrote:

Just to add to my last post - it seems to be the XML syntax is the
problem.

I’ve managed to get the single-expense working again - had to cut and
paste the XML code from the FAC API page. Might be my attention to
detail, but I’m wondering if it’s the fact that I’ve got some funny
characters in there.

Anyway, when I duplicate the ‘working’ expense item, so that there are
two of them in the XML file, I return to the 500 Internal Server
Error.

This is the contents of the file I’m trying to post:

<?xml version="1.0" encoding="UTF-8"?> 2008-03-29T Test Expense No 1 Computer Hardware -200.0 17.5 2008-03-29T Test Expense no 2 Travel -100.0 17.5

Anyone able to help with this?

DJ