使用javascript创建新的Phabricator任务
我正在尝试连接到Phabricator管道API,并通过绑定到google工作表的javascript创建任务 导管API文档并没有给出太多解释。我看过更好的API文档 下面是我的想法,但这是一个卷曲,我不知道如何使它Javascript或枯萎,这将工作与否?我感谢你的帮助使用javascript创建新的Phabricator任务,javascript,phabricator,Javascript,Phabricator,我正在尝试连接到Phabricator管道API,并通过绑定到google工作表的javascript创建任务 导管API文档并没有给出太多解释。我看过更好的API文档 下面是我的想法,但这是一个卷曲,我不知道如何使它Javascript或枯萎,这将工作与否?我感谢你的帮助 curl https://secure.phabricator.com/api/maniphest.edit \ -d api.token=api-token \ -d param= [ { "type"
curl https://secure.phabricator.com/api/maniphest.edit \
-d api.token=api-token \
-d param= [
{
"type": "title",
"value": "A value from a cell on the googlesheet"
},
{
"type": "description",
"value": "A value from a cell on the googlesheet"
},
{
"type": "subscribers.add",
"value": "A value from a cell on the googlesheet"
}
] \
一般来说,这些步骤是: 首先,在以下位置生成API令牌: 其中,
phabricator.yourdomain.com
必须由已安装phabricator的子域更改,username
必须由您的管理用户名更改
然后,假设您已经在Phabricator.yourdomain.com
中安装了Phabricator,您可以使用以下类型的URL请求API方法
其中,method\u name
必须替换为此目录中实际方法的描述符:
例如,如果要读取任务编号125
的内容,并使用生成的API标记值API-svhcp2a3qmgkkjfa5f6sh7cm4joz
,请使用方法maniphest.info
完成如下URL:
http://phabricator.yourdomain.com/api/maniphest.info?api.token=api-svhcp2a3qmgkkjfa5f6sh7cm4joz&task_id=125&output=json
可以在首选浏览器中直接测试此URL,以获得包含关于任务编号125的信息的JSON响应(确保任务ID存在)。Firefox甚至会以可读的方式显示返回的JSON
然后可以将这些工作URL插入Javascript中,如下所示:
window.location.href=http://phabricator.yourdomain.com/api/maniphest.info?api.token=api-svhcp2a3qmgkkjfa5f6sh7cm4joz&task_id=125&output=json
或者作为异步Ajax调用。我遇到了与您类似的问题(我将HTTParty与Ruby一起使用)。 为了解决这个问题,我使用了以下主体(使用您的示例):
你弄明白了吗?
"transactions[0][type]=title&transactions[0][value][0]=A value from a cell on the googlesheet&transactions[1][type]=description&transactions[1][value]=A value from a cell on the googlesheet&transactions[2][type]=subscribers.add&transactions[2][value][0]=A value from a cell on the googlesheet"