Create Project from API

I noticed that /rest/api/2/project requires 'key' as in input, is there a way to force 'key' value to be generated by JIRA itself for the sake of uniqueness so that we don't need to pass that value?

The problem is  - we are running into errors due to duplicate keys. In order to avoid duplicate 'key' issue we have to make an extra call(s) which to me is inefficient. If there is a 'key', then we should again check for a second 'key' and keep going until we find a unique - which is too much. Is there a way to avoid this situation.

Secondly - how long the key can be?

2 answers

 The project key is supposed to be descriptive... by which I mean, it's something specific to the intent of the project to help you identify it.  If the project is, say, for documentation, you want the key to be something like "DOC", not something random like "ABC123"; that way, when you get email for issue DOC-764, you know what it's about without having to look up what project "ABC123" represents.  What is the system attempting to accomplish?  If it's proxying 'create project' requests for users, perhaps you should have them request a key at the same time?

The longest key I've (seen) used is 10 characters; it can probably go longer, but you don't really want them to be too large to fit in the email subject line.

0 vote

No, the call really does just do "create with key given".  The UI has a bit of code in it that suggests new keys from the description (and it won't suggest duplicates), but that is not something you can use in REST.

A project key has a default maximum length of 10, although that can technically be changed (not recommend though, longer keys get truncated in displays and it may still break some add-ons)

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

78 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you