Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get "Project Id" to create a Direct Link?

Tags:

jira

I have my project name, but not the numeric Project Id. The latter is needed to use HTML Direct Links.I'm using JIRA 5.0.1

How do I get the numeric Project Id for a given project name?

I've searched the Project Administration area, several other places, the documentation, Google, etc but still can't find a way to get that value.

Thanks.

like image 349
jasmeet24 Avatar asked Mar 27 '12 06:03

jasmeet24


People also ask

How do I find project ID in Jira project?

Go to your project page click on project settings and details. Click on the URL and at the end you should see project ID number.

What is a project ID?

Project ID: A globally unique identifier for your project. A project ID is a unique string used to differentiate your project from all others in Google Cloud. You can use the Google Cloud console to generate a project ID, or you can choose your own.


1 Answers

This solution does not require admin rights:

Navigate to https://jira.YOURDOMAIN.TLD/rest/api/2/project/YOURPROJECTNAME and read the id in the JSON response:

{     "self":"https://jira.YOURDOMAIN.TLD/rest/api/2/project/YOURPROJECTNAME",     "id":"12345",  ☜ Project Id     "key":"YOURPROJECTNAME",     "description":..     : } 

Navigate to https://jira.YOURDOMAIN.TLD/rest/api/2/project to get a JSON list of projects.

Bonus: here's a one-liner in Groovy to get the ID:

groovy -e "println new groovy.json.JsonSlurper().parseText("https://jira.YOURDOMAIN.TLD/rest/api/2/project/YOURPROJECTNAME".toURL().text)?.id ?: 'not found'" 

A java.io.FileNotFoundException probably means that your JIRA server requires authentication.

Here's a one-liner to list all the visible projects and their ID:

groovy -e "new groovy.json.JsonSlurper().parseText('https://jira.YOURDOMAIN.TLD/rest/api/2/project'.toURL().text)?.each{println it.key+' = '+it.id}" 
like image 182
sebnukem Avatar answered Nov 14 '22 04:11

sebnukem