r - 在 R 中使用 REST API 向 JIRA 问题单添加评论
问题描述
我想从 R 以编程方式使用 REST API 向现有 JIRA 票证添加更多评论
我根据此论坛中的链接尝试了以下操作,但没有成功:
library(httr)
POST("https://xxxxxx.atlassian.net/rest/api/2/issue/issueId/comment",body = "New Comment", authenticate(userid,password, "basic"))
解决方案
我在您的论坛链接中检查了接受的答案,它建议使用以下 POST curl
:
curl -u admin:admin -X POST --data '{"body": "comment."}' -H "Content-type: application/json" http://localhost:2990/jira/rest/api/2 /issue/TEST-1/comment
请注意,正文是 JSON 内容,内容类型也设置为 JSON。您可以尝试在POST()
从以下位置调用函数时执行相同的操作httr
:
POST("https://xxxxxx.atlassian.net/rest/api/2/issue/issueId/comment",
body = '{"body": "comment."}', authenticate(userid, password, "basic"),
encode="raw")
推荐阅读
- javascript - 使用 MapContainer React Leaflet 显示图例
- azure - Azure 逻辑应用 - 无权查询订阅?
- haskell - 在统一过程中,高级类型的实例化和包含如何交互?
- typescript - 在执行转换对象的函数时如何推断类型修改?
- python - 来自数据类的 dict 返回空字典
- mysql - ping:无法解析 db1:未知主机
- node.js - node express with multer 如何在运行时选择 MemoryStorage 或 DiskStorage
- python - 使用 ray 和 numpy 有效地计算成对相似度/相异度
- javascript - 数组推送重复或跳过搜索功能内的推送
- java - 如何根据语言环境从 Spring 属性文件中注入列表