Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

My jira server's version is v8.5.6. When I call the rest api Get valid project key, it doesn't work.

I see the document: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-key-and-name-validation/#api-rest-api-3-projectvalidate-validprojectkey-get

I want to Get valid project key.

When I call the rest api which uri is /rest/api/latest/projectvalidate/validProjectKey

the response is <?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>404</status-code><message>null for uri: http://mydomain/rest/api/latest/projectvalidate/validProjectKey?key=HSP</message></status>

2 answers

1 accepted

0 votes
Answer accepted

Hi @Ronaldo Huang I checked the endpoint on CLoud it it is working as documented. I think you have Server/Cloud problem. I guess you are on Server (at least your question is created with "jira-server" attribute, but the documentation is for Cloud version of Jira.

There is similar endpoint for server but it probably only validates project key and do not suggest valid one:

https://docs.atlassian.com/software/jira/docs/api/REST/8.13.1/#api/2/projectvalidate

@Martin Bayer _MoroSystems_ s_r_o__ 

Hi, how can I get a suggested valid key from my local jira server by rest api which is like GET /rest/api/3/projectvalidate/validProjectKey on cloud?

Only 'GET /rest/api/2/projectvalidate/key' which validates project key is avaiable in the document above.

Hi @Ronaldo Huang I don't think it is possible. I'm checking it on old Jira (7.6.x) and it looks like when new project is going to be created, the "key" suggestion is done by JavaScript on frontend and it is validate using mentioned endpoint and it does not provide valid KEY in the response.

I think you will have to do it programatically... for example

only schema of the code

def key = suggestedKey
while(!isValid(key)){
key = incrementKey(key)
}

You have to implement methods 

  • incrementKey with the code which will check if KEY ends with number and if so, split it and add number+1 and check again
  • isValid which will validate existence of key using endpoint in my previous response
0 votes

Those are cloud API paths.

Try this endpoint -

/rest/api/2/projectvalidate/key

You can see the API's available for your version here.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you