Trying to create issue with label, issue is created but label field is empty
in JSON file i have
"labels": [ "MANAGED_SERVICES" ],
headers = {"Content-Type": "application/json"}
data = {"fields":{"project":{"key":"CP"},"summary":"OC SPLA usage report for {current_month} {currentYear}".format(**locals()),"description":"Review OC SPLA usage report","issuetype":{"name":"Managed Service"},"customfield_10107":{"id":"10505"},"customfield_10006":"CP-3289"},"creator":{"displayname":"some user"},"labels": ["MANAGED_SERVICES"]}
finally found answer:
had to reorder fields
headers = {"Content-Type": "application/json"}
data = {"fields":{"labels":["MANAGED_SERVICES"],"reporter":{"name":"user"},"assignee":{"name":"emergencyadmin"},"project":{"key":"CP"},"summary":"OC SPLA usage report for {previous_month} {currentYear},"description":"some descr","issuetype":{"name":"Managed Service"},"customfield_10107":{"id":"10505"},"customfield_10006":"CP-3289"}}}
Could you verify that you've got "labels" on the screens for project CP and issue type "Managed Service"?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks for reply, i posted a picture-managed_service is visible from drop-down menu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @[deleted], Can you include the 'creator' and 'labels' attributes with in the project scope in the JSON file. Like below.
{"fields":{"project":{"key":"CP"},"summary":"OC SPLA usage report for {current_month} {currentYear}".format(**locals()),"description":"Review OC SPLA usage report","issuetype":{"name":"Managed Service"},"customfield_10107":{"id":"10505"},"customfield_10006":"CP-3289","creator":{"displayname":"some user"},"labels": ["MANAGED_SERVICES"]}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
"creator": { "active": true, "avatarUrls": { "16x16": "https://secure.gravatar.com/avatar/5d92f3ce51d4a090cdcb9b77ee890989?d=mm&s=16", "24x24": "https://secure.gravatar.com/avatar/5d92f3ce51d4a090cdcb9b77ee890989?d=mm&s=24", "32x32": "https://secure.gravatar.com/avatar/5d92f3ce51d4a090cdcb9b77ee890989?d=mm&s=32", "48x48": "https://secure.gravatar.com/avatar/5d92f3ce51d4a090cdcb9b77ee890989?d=mm&s=48" }, "displayName": "some user", "emailAddress": "someuser@company.com", "key": "someuser", "name": "someuser", "self": "https://jira.corp.company.com/rest/api/2/user?username=someuser", "timeZone": "Europe/Belgrade" },
"labels": [ "MANAGED_SERVICES" ], "lastViewed": "2018-06-07T10:09:11.206+0000",
sorry for bad formatting
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.
Hi Dragan,
is it your exactly sent json?
{"fields":{"project":{"key":"CP"},"summary":"OC SPLA usage report for {current_month} {currentYear}".format(**locals()),"description":"Review OC SPLA usage report","issuetype":{"name":"Managed Service"},"customfield_10107":{"id":"10505"},"customfield_10006":"CP-3289"},"creator":{"displayname":"some user"},"labels": ["MANAGED_SERVICES"]}
It has something strange like .format(**locals()).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aleksandr,
current_month = datetime.now().strftime('%B')
currentYear = datetime.now().year
subject contains current month and year, that's why i put .format(**locals()), it's python interpolation syntax
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.