How do I form the request using Epic link, Environment identified, Effected versions for API?

Rahul Naik March 7, 2018

I am able to create the issues in a project using API by sending the below JSON.

request.body = {
"fields": {
"project": {
"key": "ABC"
},
"summary": "testing",
"description": "sample task",
"issuetype": {
"name": "Bug"
}
}.to_json

In another project there are the following mandatory fields: Epic Link, Environment Identified, Affects Version/s.

I tried the passing the parameters in the below format in the above json but it says bad request.

"epic_link": "TestErrors",
"environment": "Staging",
"versions": "test",

Can you help me with the correct key names and the type of values I must give for the above 3 fields?

1 answer

1 vote
Kyle Moseley
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 7, 2018

Epic Link is a custom field so set it as a custom field ID.

Set versions similar to how you're doing issuetypes (allow for multiples), but make sure to specify if it's affected or fix versions.

I think Environment is good.

https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#editing-an-issue-examples

Rahul Naik March 9, 2018

Hi Kyle,

In the docs, I was able to find the keys: "versions" and "fixVersions". Can you tell the name of the key for "Affects Version/s" field?

I've tried the following but it's not working. If you could tell the name of the key and syntax in which I should be passing the values, it'll be of great help.

"versions": [
{
"value": "test_v1"
}
],

 "affectedVersions": ["test_v1"],
 "affectedVersions": [
 {
 "value": "test_v1"
 }
 ],

 "affectedVersion": ["test_v1"],
 "affectedVersion": [
 {
 "value": "test_v1"
 }
 ],

Kyle Moseley
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 9, 2018

I looked into it and confusingly it's version for Affect/s Versions.

 

https://developer.atlassian.com/cloud/jira/platform/rest/#api/2/issue-getEditIssueMeta

Kyle Moseley
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 20, 2018

Hello. If this answer helped, please use the check mark to accept the answer. Thanks!

Suggest an answer

Log in or Sign up to answer