调用RESTAPI在JIRA中创建新组件

调用RESTAPI在JIRA中创建新组件,rest,httpclient,jira,Rest,Httpclient,Jira,我要用吉拉做一个新组件 我找到了用于制作新组件的POST-url/rest/api/2/component,但我不知道应该给出什么类型的输入 DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost postRequest = new HttpPost("http://localhost:8080/rest/api/2/component/"); String authorization = JiraRequestResp

我要用吉拉做一个新组件 我找到了用于制作新组件的POST-url/rest/api/2/component,但我不知道应该给出什么类型的输入

DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost postRequest = new HttpPost("http://localhost:8080/rest/api/2/component/");

String authorization = JiraRequestResponseUtil.conversionForAuthorization();
postRequest.setHeader("Authorization", authorization);

StringEntity input = new StringEntity("\"name\":\"Component 1\",\"description\":\"This is a TEST JIRA component\" ,\"leadUserName\":\"fred\",\"assigneeType\":\"PROJECT_LEAD\",\"isAssigneeTypeValid\":\"false\",\"project\":\"TEST\"");

input.setContentType("application/json");
postRequest.setEntity(input);

HttpResponse response = httpClient.execute(postRequest);
这是我正在实现的代码

我获取的输出失败:HTTP错误代码:400


请帮忙。

我们不能告诉你。您需要找到关于您发布到的服务的文档。

以上代码是正确的,只需将{&}添加到JSON字符串中即可