need to change project's issueType scheme with rest api

antoine-externe_lavaud June 10, 2021

Hi,

i try to change the IssueType Scheme of project with Rest API PUT.

for this i've Project ID and IssueType Scheme ID (or i think it is...)

for getting Project ID :

curl -u USER:PASSWORD -X GET -H "Content-Type: application/json" "https://MYDOMAIN/rest/api/2/project/" | jq '.[]|select(.key | endswith("LAST_CHAR_OF_PROJECT_NAME"))' | jq '.id'

i get "26700". Ok

for getting IssueType Scheme ID :

curl -u USER:PASSWORD -X GET -H "Content-Type: application/json" "https://MYDOMAIN/rest/api/2/issuetypescheme/" | jq '.schemes[]|select(.name | contains("ISSUE_TYPE_SCHEME_NAME"))' | jq '.id'

i get "62600". Ok


Now has it's say in issuetypescheme-project-put

i send this :

curl --user USER:PASSWORD -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' 'https://MYDOMAIN/rest/api/2/issuetypescheme/project' --data '{
"issueTypeSchemeId": "62600",
"projectId": "26700"
}'


and i get this error :

{"errorMessages":["Unrecognized field \"issueTypeSchemeId\" (Class com.atlassian.jira.issue.fields.rest.json.beans.IssueTypeSchemeCreateUpdateBean), not marked as ignorable\n at [Source: org.apache.catalina.connector.CoyoteInputStream@5554acbf; line: 2, column: 25] (through reference chain: com.atlassian.jira.issue.fields.rest.json.beans.IssueTypeSchemeCreateUpdateBean[\"issueTypeSchemeId\"])"]}


Please, does anyone has an idea ?


regards.

2 answers

1 accepted

1 vote
Answer accepted
Niranjan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 10, 2021

Hi @antoine-externe_lavaud  - Is your project a classic project?

1. Issue type schemes can only be assigned to classic projects.

2. If any issues in the project are assigned issue types not present in the new scheme, the operation will fail. To complete the assignment those issues must be updated to use issue types in the new scheme.

antoine-externe_lavaud June 10, 2021

hi @Niranjan 

ok, i try to change from IssueType Scheme containing :

Bug, Epic, Pre-Condition, Story, Sub-task Sub-Task, Task, Test, Test Execution, Test Plan, Test Set

to IssueType Scheme containing :

Bug, Enabler, Epic, New Feature, Story, Sub-task Sub-Task, Task

 

So, yes, Enabler and New Feature are not in the present scheme and some issue type will going to be remove.

Actually i only avec one Bug Issue in this project.

 

Are you sur that's can't be change... ?

(i think this PUT is really useless if we can't change it that way...)

Like taguchi likes this
Niranjan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 10, 2021

Hi @antoine-externe_lavaud ,

I just noticed that you are on JIRA server. I was misled by the doc link that you shared (It was pointing to jira Cloud Doc).

You cannot associate a project with a issuetype scheme in JIRA server.

https://jira.atlassian.com/browse/JRASERVER-59948 - Open feature Request

David Bakkers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 10, 2021

Nice work @Niranjan

I saw the server tags in the post, but didn't check the link that was supplied to see if the correct documentation was being referenced.

Like Niranjan likes this
0 votes
David Bakkers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 10, 2021

Hello @antoine-externe_lavaud 

Your PUT request to the /rest/api/2/issuetypescheme/project endpoint looks to be properly formed and the curl code looks correct too, so I don't know why you're seeing that error. It looks like there is some problem parsing the issueTypeSchemeId definition in the JSON of the request body.

I don't have access to Jira Server anymore to test with, but the same PUT request to Jira Cloud using the v3 REST API works perfectly.

Try sending the same PUT request to the same endpoint, but omit the issueTypeSchemeId definition from the request body. Do you get this message back?

"An issue type scheme ID and a project ID have to be provided"

If so, then try using a REST test tool like Postman or similar to test your full PUT request to see if there is some small, hidden mistake somewhere in your code.

Suggest an answer

Log in or Sign up to answer