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 votes

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
Community showcase
Posted Oct 09, 2018 in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

393 views 6 0
Join discussion

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