评论列表
jiaowang 2017-05-12 14:00:22 回复
您好。我想通过http://xxxxxxxxxx/zentao/task-create-7--394.html?sid=sessionID&t=json这种方式新建一个任务,用post方式并以form-data方式加上name和type参数却无法创建,但用同样方法可以编辑任务,请问是为什么?
回复
找下错误日志。看看字段是否都完整了。
张生 2017-05-09 18:16:24 回复
已经登录成功了,在获取BUG的过程中,已经传递了Session的了为什么还要登录呢?
回复
检查下传递的参数是否正确。
fhj 2020-05-29 17:14:46 回复
一、获得session。获取成功
二、验证用户身份。验证成功
三、调用创建bug的API。调用/pro/bug-create-43-0-moduleID=1804.json?zentaosid=73nu4ijkn4es3ud4v2u0u5p7g1,返回一大段json(都是些产品信息的json),

{
"status": "success",
"data":"{\"title\":\"SPF-PRO\提Bug\",\"products\":{\"66\":\"LAS6200\底\层dll\",\"65\":\"\。。。。。。。。

,\"moduleID\":\"1804\",\"projectID\":0,\"taskID\":0,\"storyID\":0,\"buildID\":0,\"caseID\":0,\"runID\":0,\"version\":0,\"testtask\":0,\"bugTitle\":\"\",\"pri\":3,\"steps\":\"<p>[\步\骤]<\\/p><br\\/><p>[\结\果]<\\/p><br\\/><p>[\期\望]<\\/p><br\\/>\",\"os\":\"\",\"browser\":\"\",\"projectMembers\":{\"\":\"\",\"admin\":\"A:admin\",\"},\"assignedTo\":\"\",\"deadline\":\"\",\"mailto\":\"\",\"keywords\":\"\",\"severity\":3,\"type\":\"codeerror\",\"branch\":\"0\",\"branches\":[],\"color\":\"\",\"pager\":null}",
"md5": "54e0527c9f942d062732a5e632f99b0b"
}

但查看发现bug没有建起。大神可以解答下吗
回复
用f12查看表单提交的信息。
陈尧一 2017-04-05 15:10:17 回复
您好,我想在其他系统里中做一个一键创建BUG的功能,其实也就是在找禅道是否有API可以创建BUG。
回复
1. 先调我们的登录接口进行身份验证。
2. 参照我们的bug表单提交页面,组织post数据,提交就行。
具体的请参考我们的api接口文档。注意每次会话要带着session id
海军 2017-02-06 17:37:52 回复
请教下,创建bug的api需要怎么写?
http://112.74.99.88:8000/zentao/bug-create.json?sid=i9pohbugcb1km3a658favd5uj1&t=json
我这样写能够创建成功不过不能返回json格式的数据
回复
表单类操作没有单独的api,可以参考现在的表单post请求。
海军 2016-12-09 21:48:41 回复
1.获取Session: http://域名/index.php?m=api&f=getSessionID&t=json
返回:
Array
(
[status] => success
[data] => {"title":"","sessionName":"sid","sessionID":"86s9qhr4ek57m7ebg34noq2gh5","rand":8357,"pager":null}
[md5] => 9914448a2c07b513d47b04be87f16237
)

2.验证用户身份:http://域名/index.php?m=user&f=login&t=json&sid=86s9qhr4ek57m7ebg34noq2gh5
返回:
Array
(
[status] => success
[user] => Array
(
[id] => 1
[account] => admin
[email] =>
[realname] => admin
[gender] => m
[dept] => 0
[role] =>
[company] => abc
)

)
3.调用API
http://域名/index.php?m=user&f=create&t=json&deptID=0
返回:
<html><meta charset='utf-8'/><style>body{background:white}</style><script>self.location='/index.php?m=user&f=login&t=json&referer=L2luZGV4LnBocD9tPXVzZXImZj1jcmVhdGUmdD1qc29uJmRlcHRJRD0w';

为何会登陆失败呢?
回复
需要将sessionid追加在请求的串里面。
liu 2016-12-09 20:38:21 回复
在调用:http://域名/index.php?m=user&f=create&t=json,接口时,返回如下结果:

<html><meta charset='utf-8'/><style>body{background:white}</style><script>self.location='/index.php?m=user&f=login&t=json&referer=L2luZGV4LnBocD9tPXVzZXImZj1jcmVhdGUmdD1qc29u';

</script>
未来 2020-05-23 09:37:29 回复
一、获得session。获取成功
二、验证用户身份。验证成功
三、调用相应的API。调用/zentao/task-view-12847.json?zentaosid=xxxx,但是还是让登录
回复
检查是否后台打开了密码弱口令检查
未来 2020-05-22 20:57:54 回复
登录成功之后调用接口/zentao/task-view-12847.json?zentaosid=" + sessionId, sessionId也传入了,还是让我登录
swain 2016-07-20 16:46:22 回复
调用相应的API,url地址改为json.请求时成功了,可是返回的不是json数据而是html代码。比如我请求添加项目添加成功返回“<html><meta charset='utf-8'/><style>body{background:white}</style><script>parent.location='/zentao/www/project-create-5.json”。添加失败返回alert()弹窗提示错误信息。我既然当作接口来用,没有返回状态码和错误信息就不知道是否添加成功啊。。
回复
禅道的接口都是和正常的浏览器浏览的页面共用的,这样可以做到代码的最大重用。
你可以根据返回的json数据匹配特征串也可以达到效果。