3

I am using the JIRA Python REST API to create an issue in JIRA, but I don't know how to set the date created and date updated fields for an issue, as well as format the date to how JIRA wants it. My is code below:

jira.create_issue(project={'key': 'DEL'}, 
created='10/4/2012  9:30:00 AM', 
updated='12/22/2012  10:00:00 AM', 
priority={'name': 'Critical'}, 
summary='My summary', 
description='My description', 
issuetype={'name': 'Bug'})

It gives me the annoying error that it doesn't even recognize the fields even though they exist (reference: http://jira-python.readthedocs.org/en/latest/index.html):

JIRAError: HTTP 400: "{u'updated': u"Field 'updated' cannot be set. It is not on the appropriate screen, or unknown.", u'created': u"Field 'created' cannot be set. It is not on the appropriate screen, or unknown."}"

4 Answers 4

3

You can change the issue creation date with a CSV file import (even on existing issues):

Create a file with the following content:

issue key, date created, summary
TST-30002,30/11/13 22:00,

The summary field is mandatory, but you can leave it empty to preserve the current summary text.

  • Go to "External System Import" in the JIRA Administration (JIRA Administration button > System) or use the shortcut "." and search for "External System Import".
  • Choose "CSV".
  • Select the file above and check the correct encoding and delimiter , under "Advanced".
  • On next page, select the project where your existing issues reside and set the date format to dd/MM/yy HH:mm (valid Java SimpleDateFormat)
  • On next page, map the fields with the same name. E.g. issue key to Issue Key.
  • Start the import process on the next page.
Sign up to request clarification or add additional context in comments.

Comments

2

In my Jira v.5.2.1 these fields are not available for editing. I think you cannot change these fields because they are 'timespamped' by the server and cannot be edited. Also, Atlassian does not mention these fields in their REST API docs.

If you do need to update these fields you can update directly in the database it's connected to.

Also, useful forum for this type of questions is answers.atlassian.com

PS. This should probably be a comment rather than answer but I don't have reputation 50 yet.

Comments

1

I don't know if you can set the updated and created fields via the REST API (or even the old SOAP). I know the JIRA Importers will do that, and in the past I've had to write my own remote methods to modify those fields.

~Matt

1 Comment

How did you write your own methods to modify those fields, out of curiosity?
0

Currently JIRA remote APIs do not support storing historical data (past comments, worklog transitions or field changes). Actually JIRA API (on the server side) does not really support it storing such info (except for comments and worklogs). They are working on it .

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.