Hi together,
I have a Problem with the Jira REST API. I´m trying to transfer Requirements from one Jira Instance to another. I´m using Power Scripts: SIL for this, but I guess its a general question/problem.
I´m trying to create Issues in the 2nd Jira Instance over REST API and with some fields it works fine. But I want to pass all fields like priority, labels and so on.
My current JSON-String looks like this:
string jsonString = "{"+
"\"fields\": {"+
"\"project\":"+
"{"+
"\"key\": \""+ projectKey_OfIssue +"\""+
"},"+
"\"summary\": \""+ summary_OfIssue +"\","+
"\"description\": \""+ description_OfIssue +"\","+
"\"issuetype\": {"+
"\"name\": \""+ issuetypeName_OfIssue +"\""+
"},"+
"\"reporter\": {"+
"\"name\": \""+ reporter_OfIssue +"\""+
"},"+
"\"priority\": {"+
"\"Id\": \""+ priority_OfIssue +"\""+
"},"+
"\"labels\": [ "+
labels_OfIssue+
" ],"+
"\"customfield_10205\": \""+ projectItemKey_OfIssue + "\""+
"}"+
"}";
Currently I´m trying it with hardcoded Strings for the variables. In the future it will get the Values automatically over Variable Resolution from SIL (summary and so on).
The String as an output looks like this:
{"fields": {"project":{"key": "TESTPROJ"},"summary": "New Issue created with Rest API","description": "Test Description","issuetype": {"name": "Work Package"},"reporter": {"name": "user"},"labels": [ "Hardware", "Software" ],"customfield_10205": "TESTPROJ-13"}}
The response of the server is this (its the same for priority):
400:{"errorMessages":[],"errors":{"labels":"Field 'labels' cannot be set. It is not on the appropriate screen, or unknown."}}:
I´ve already tried using "name" OR "id" as priority, nothing works, also I´ve tried different orders of fields, still not working.
I hope somebody can help with this.
Best regards,
Wilhelm
Hi Wilhelm,
That error message means that it cannot find the field in create issue screen. Can you please check that fields "Labels" and "Priority" are added to create issue screen of issue type "Work Package"?
I'm glad that your issue is resolved :)
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.