Here is my code -
IssueRestClient issueClient = restClient.getIssueClient();
IssueInputBuilder issueInputBuilder = new IssueInputBuilder(project, key, summary);
issueInputBuilder.setDescription(summary);
IssueType issueType = new IssueType(jiraServerUri, key, summary, false, "Testing creating issue REST API client", null);
issueInputBuilder.setIssueType(issueType);
BasicComponent component = new BasicComponent(jiraServerUri, 1L, "Sample-component", "abcdefgh Testing rest api");
issueInputBuilder.setComponents(component);
List<ComplexIssueInputFieldValue> a1 = new ArrayList<ComplexIssueInputFieldValue>();
Map<String, Object> valuemapMap = new HashMap<String, Object>();
valuemapMap.put("id", "");
Map<String, Object> valuemap2 = new HashMap<String, Object>();
valuemapMap.put("value", a1);
ComplexIssueInputFieldValue fieldvalue = new ComplexIssueInputFieldValue(valuemap2);
a1.add(fieldvalue);
issueInputBuilder.setFieldValue("customfield_14617", "Test");
issueInputBuilder.setFieldValue("customfield_15101", new ComplexIssueInputFieldValue(valuemapMap));
issueInputBuilder.setFieldValue("customfield_14623", new ComplexIssueInputFieldValue(valuemapMap));
issueInputBuilder.setFieldValue("customfield_18202", a1);
issueInputBuilder.setFieldValue("versions", a1);
IssueInput issueInput = issueInputBuilder.build();
Promise<BasicIssue> promise = restClient.getIssueClient().createIssue(issueInput);
promise.isDone returns false and issue is not created in jira server.
Does anyone have sample example code to create jira with java restcliend. by considering some of the custom_fields for particular project are mandatary. and create issue with all those fields.
Hello,
You said that there are some mandatory fields for your project. Do you set values for them in your code?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Usually Jira returns also the exact error with the response in Json. Look at the Json returned by Jira.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is the error i get after setting values for all customfields. Says required even after passing values to it
RestClientException{statusCode=Optional.of(400), errorCollections=[ErrorCollection{status=400, errors={customfield_18202=Exists On is required., versions=Affects Version/s is required., customfield_15101=Found by is required., customfield_14623=Development Stage is required.}, errorMessages=[]}]}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.