英文:
Zenhub API: {"message":"Validation failed: Issues would create a cycle in epics"}
问题
我正在尝试使用ZenHubIO API来在Jira、Github和ZenHub之间同步问题。我可以从Jira创建问题到Github,没有问题。然而,如果问题是一个Epic,那么Epic就无法正确同步(在Jira上被认为是Epic,但在Github/ZenHub上不是)。我找到了问题所在,它归结为POST请求。根据API的说明,请求应该采用以下形式:
curl -X POST https://api.zenhub.com/p1/repositories/<repo #>/issues/<issue #>/convert_to_epic -H 'X-Authentication-Token: AUTH TOKEN' -H "Content-Type: application/json" -d '{"issues": [{"repo_id": <repo #>, "issue_number": <issue #>}]}'
我确保使用正确的凭据和仓库/问题编号进行API调用,通过运行其他API调用来验证它们是否正常工作。然而,当我运行上述请求时,我得到的回应是{"message":"Validation failed: Issues would create a cycle in epics (<*some number*>)"}
。我测试的每个问题都是新创建的问题,即没有依赖关系,没有父级Epic,也不是Epic本身等。有关如何解决此问题或如何更好地诊断此问题的任何指示吗?我正在使用Golang自动化进行HTTP请求的过程,但我不认为这很重要。
英文:
I'm trying to use the ZenHubIO API to sync issues between Jira, Github and ZenHub. I have no issue creating issues from jira to github. However, if the issue is an Epic, the Epic is not synced correctly (i.e. considered an Epic on Jira but not on Github/Zenhub). I managed to track down the issue and it comes down to the POST request. Following the API, the request should be in the form
curl -X POST https://api.zenhub.com/p1/repositories/<repo #>/issues/<issue #>/convert_to_epic -H 'X-Authentication-Token: AUTH TOKEN' -H "Content-Type: application/json" -d '{"issues": [{"repo_id": <repo #>, "issue_number": <issue #>}]}'
I've made sure I make the API calls with the correct credentials and repo/issue numbers by running other API calls that work just fine. However, when I run the above request, I'm greeted with {"message":"Validation failed: Issues would create a cycle in epics (<*some number*>)"}
. Every issue I test this on is a newly created issue i.e. has no dependencies, no parent epics, is not an epic itself, etc. Any pointers on how to solve this or what I could do to better diagnose this problem? I'm using Golang to automate the process of http requests but I don't think it matters.
答案1
得分: 0
原来问题非常微不足道。我在请求中发送了一个请求体(请参见问题中的命令末尾)-H "Content-Type: application/json" -d '{"issues": [{"repo_id": <repo #>, "issue_number": <issue #>}]}'
。
由于我已经在URL中指定了仓库编号和问题编号,所以不需要再添加请求体。我猜测它尝试将其转换为epic两次?这导致了错误消息的出现。我认为,如果将仓库编号和问题编号设置为POST URL中的变量,可以发送带有多个仓库编号和问题编号的请求体。
英文:
So turns out it was a very trivial issue. I was sending a request body (see the end of the command in the question) -H "Content-Type: application/json" -d '{"issues": [{"repo_id": <repo #>, "issue_number": <issue #>}]}'
Since I already specified the repo number and issue number in the url itself, I didn't need to also add a body. I'm guessing it was trying to convert to an epic twice? which gave me that error message. I think one could send a request body with multiple repo IDs and issue numbers if one were to set the repo id and issue id as a variable in the POST url.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论