curl POST XML 和 Harvest API

发布于 2024-10-26 13:39:04 字数 704 浏览 3 评论 0原文

Harvest API 的以下curl 请求生成“我们很抱歉,但出了点问题”错误。知道我可能做错了什么吗?也许我没有正确格式化 XML POST?我已经能够使用 API 成功执行 GET 请求。我已在下面的代码中替换了我的特定域和用户帐户信息。

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

自此以后,行同陌路 2024-11-02 13:39:04

我认为你的格式有点不对,

试试这个:

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

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>"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文