curl POST XML and Harvest API

1.2k Views Asked by At

The following curl request of the Harvest API is generating a "We're sorry, but something just went wrong" error. Any idea what I might be doing wrong? Perhaps I am not formatting the XML POST properly? I have been able to successfully execute GET requests with the API. I have replaced my specific domain and user account info in the code below.

curl https://domain.harvestapp.com/daily/add/ -H 'Content-Type: application/xml' -H 'Accept: application/xml' -u [email protected]:password --data-urlencode "<request><notes>Test api support</notes><hours>3</hours><project_id type='integer'>1234567</project_id><task_id type='integer'>12345</task_id><spent_at type='date'>Fri, 25 Mar 2011</spent_at></request>"
1

There are 1 best solutions below

0
On BEST ANSWER

I think your formatting is just a little bit off,

Try this :

    curl https://domain.harvestapp.com/daily/add -H 'Accept: application/xml' -H 'Content-Type: application/xml' -u [email protected]:password -X POST -d "<request><notes>Test api support</notes><hours>3</hours><project_id type=\"integer\">12345</project_id><task_id type=\"integer\">23456</task_id><spent_at type=\"date\">Fri, 27 May 2011</spent_at></request>"