2011-03-26 62 views
2

Harvest API的以下curl請求正在生成「我們很抱歉,但出錯了」錯誤。任何想法我可能做錯了什麼?也許我沒有正確地格式化XML POST?我已經能夠使用API​​成功執行GET請求。我已經在下面的代碼中替換了我的特定域和用戶帳戶信息。curl POST XML和Harvest API

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>" 

回答

2

我覺得你格式化只是一點點了,

試試這個:

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>"