JIRA throws "The request sent by the client was syntactically incorrect" when deleting actors from Project Roles via REST API
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Problem
When trying to delete actors from Project Roles via REST API using the following command, the following error is thrown
Command
1
curl -u admin:admin -X DELETE --data @data.txt -H "Content-Type: application/json" http://10.60.4.105:8641/jira/rest/api/2/project/DUMMY/role/10000
Error
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<html>
<head>
<title>Apache Tomcat/7.0.55 - Error report</title>
<style>
<!--H1 {
font-family: Tahoma, Arial, sans-serif;
color: white;
background-color: #525D76;
font-size: 22px;
}
H2 {
font-family: Tahoma, Arial, sans-serif;
color: white;
background-color: #525D76;
font-size: 16px;
}
H3 {
font-family: Tahoma, Arial, sans-serif;
color: white;
background-color: #525D76;
font-size: 14px;
}
BODY {
font-family: Tahoma, Arial, sans-serif;
color: black;
background-color: white;
}
B {
font-family: Tahoma, Arial, sans-serif;
color: white;
background-color: #525D76;
}
P {
font-family: Tahoma, Arial, sans-serif;
background: white;
color: black;
font-size: 12px;
}
A {
color: black;
}
A.name {
color: black;
}
HR {
color: #525D76;
}
-->
</style>
</head>
<body>
<h1>HTTP Status 400 - Bad Request</h1>
<HR size="1" noshade="noshade">
<p><b>type</b> Status report</p>
<p><b>message</b> <u>Bad Request</u>
</p>
<p><b>description</b> <u>The request sent by the client was syntactically incorrect.</u>
</p>
<HR size="1" noshade="noshade">
<h3>Apache Tomcat/7.0.55</h3>
</body>
</html>
Diagnosis
When using the same command to add actors to project roles, it doesn't run into any problem
Command
1
2
curl -u admin:admin -X POST --data @data.txt -H "Content-Type: application/json" http://10.60.4.105:8641/jira/rest/api/2/project/DUMMY/role/10000
Cause
This is a known mistake with the documentations regarding deleting actors from project roles tracked in the following
JRASERVER-32422 - Update JIRA REST documentation about removing a user from a project role
JRASERVER-33367 - REST API handling inconsistent for Project Roles
The DELETE method does not allow application/json, you must modify the URL to delete actors from project roles.
Solution
Resolution
Modify the URL to be like the following to delete actors from Project Roles
1
http://<JIRA_URL>:<port>/rest/api/2/project/{PROJECTKEY}/role/{ROLEID}?user={username}
1
http://<JIRA_URL>:<port>/rest/api/2/project/{PROJECTKEY}/role/{ROLEID}?group={groupname}
Was this helpful?