Hi All,
I was going through the article "Writing a REST Client in python". I wanted to modify it to create issues in JIRA. I have already tested the POST API of JIRA using the curl command line and it works fine.
curl -D- -u <username>:<passwd> -X POST --data @data.txt -H "Content-Type: application/json" https://<jira-url>
So i modified the python code mentioned in the article "Writing a REST Client in python". I am using python2.7. The GET API works fine as mentioned in the article. Also i am using the python-rest-client package.
The code changes for the POST is as follows:
jiraF=open("/root/data.txt","r")
jira_input=json.loads(jiraF.read())
jira_input_raw=json.dumps(jira_input)
resp = conn.request_post("/issue/", body=jira_input_raw, headers={'content-type':'application/json', 'accept':'application/json'})
When i execute the command
python2.7 jira-create.py
I get the following error message from JIRA site
The status message is 400
The JSON response output is {"errorMessages":[],"errors":{"summary":"Field 'summary' cannot be set. It is not on the appropriate screen, or unknown.","components":"Field 'components' cannot be set. It is not on the appropriate screen, or unknown.","versions":"Field 'versions' cannot be set. It is not on the appropriate screen, or unknown.","customfield_18130":"Field 'customfield_18130' cannot be set. It is not on the appropriate screen, or unknown.","customfield_13232":"Field 'customfield_13232' cannot be set. It is not on the appropriate screen, or unknown.","description":"Field 'description' cannot be set. It is not on the appropriate screen, or unknown.","reporter":"Field 'reporter' cannot be set. It is not on the appropriate screen, or unknown.","customfield_19030":"Field 'customfield_19030' cannot be set. It is not on the appropriate screen, or unknown."}}
Has anyone implemented creating issue in JIRA using python-rest-client package which is mentioned in this article. Or else can anyone tell me what could be the problem here.