Create Jira Service Desk Project REST API Error Projectlead

Rika Mandasari
Contributor
April 20, 2020

Tried to create project via REST API on Postman

POST  - (mysite)rest/api/3/project

{
"notificationScheme": 10021,
"description": "Example Project description",
"leadAccountId":"xxxxxx@gmail.com",  
"url": "https://rika.atlassian.net/",
"projectTemplateKey": "com.atlassian.servicedesk:simplified-it-service-desk",
"avatarId": 10200,
"issueSecurityScheme": 10001,
"name": "Example",
"permissionScheme": 10011,
"assigneeType": "UNASSIGNED",
"projectTypeKey": "service_desk",
"key": "EX",
"categoryId": 10120
}

 

returned with error;

 

{    "errorMessages": [],    "errors": {        "projectLead": "You must specify a valid project lead."    }}

 

tried to change leadAccountID with lead but still not working

please advise how to fix this

1 answer

0 votes
Mohamed Benziane
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 20, 2020

Hello @Rika Mandasari 

Can you change the leadaccountID parameter by "lead" and put the username of the project lead and not his mail account (unless the username is the mail adress)

 

Hope this helps

Fredy Lie
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 20, 2020

Hi,

 

I did change to "lead" and put the user name but it returned another error said;

{
"errorMessages": [
"'accountId' must be the only user identifying query parameter in GDPR strict mode."
],
"errors": {}
}

Mohamed Benziane
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 20, 2020

Try this :

lead : "accountid"
Rika Mandasari April 20, 2020

I am site admin

Untitled.pngCapture.JPG

Mohamed Benziane
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 20, 2020

You can use this api to get your account id or got to your profile and look at the url you should have something like this

jira id.png

atlassian.net/jira/people/558548:0f98599f-1633-4h65-9428-d8c30p65a2f8

I'm not sure but the Id come after the ":"

Rika Mandasari April 20, 2020

I did try;

 

lead":"5dba4d4dd0d0d60c2e06ac6d",

{
"errorMessages": [
"'accountId' must be the only user identifying query parameter in GDPR strict mode."
],
"errors": {}
}

then I tried this too;

"accountId":"5dba4d4dd0d0d60c2e06ac6d",

{
"errorMessages": [
"Unrecognized field \"accountId\" (Class com.atlassian.jira.rest.v2.issue.project.ProjectInputBean), not marked as ignorable\n at [Source: org.apache.catalina.connector.CoyoteInputStream@4d00eb7f; line: 4, column: 16] (through reference chain: com.atlassian.jira.rest.v2.issue.project.ProjectInputBean[\"accountId\"])"
]
}

Mohamed Benziane
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 20, 2020

I just tried this and it's work fine

{  "notificationScheme"10000, 
"description""Example Project description",
"leadAccountId" : "557058:0f94727f-1649-4c66-9538-a8c29b64a2f8",  
"url""http://atlassian.com",  
"projectTemplateKey""com.atlassian.jira-core-project-templates:jira-core-simplified-process-control",  
"avatarId"10200,  
"issueSecurityScheme"10001, 
 
"name""Example",  
"permissionScheme"10011, 
 
"assigneeType""PROJECT_LEAD", 
 
"projectTypeKey""business",  
"key""EX"  
}

In your url profile take everything after the last "/", this is your account id

atlassian.net/jira/people/578058:0f2151515-2548-5n55-9538-a8125882f8 

Rika Mandasari
Contributor
April 20, 2020

hi thanks for responding,

Got another different error 500

Capture.JPGCapture2.JPG

Mohamed Benziane
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 21, 2020

Error 500 means the json data is not valid.

I try this code in python and it works fine, i'm not familiar with postman :

import requestsfrom requests.auth import HTTPBasicAuthimport json
url = "https://yourURL.atlassian.net/rest/api/3/project"
auth = HTTPBasicAuth("username""api_token")

headers = {   "Accept""application/json",   "Content-Type""application/json"}

payload = json.dumps( 
{
  "notificationScheme"10000, 
 
"description""Example Project description",  
"leadAccountId" : "yourID",  
"url""http://atlassian.com",  
"projectTemplateKey""com.atlassian.servicedesk:simplified-it-service-desk",  "avatarId"10200,
  "issueSecurityScheme"10001,
  "name""Example",  "permissionScheme"10011,  
"assigneeType""PROJECT_LEAD",  
"projectTypeKey""service_desk",  
"key""EX"} )

response = requests.request(   "POST",   url,   data=payload,   headers=headers,   auth=auth)

print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(","": ")))

This code is provided by the cloud api documentation :

https://developer.atlassian.com/cloud/jira/platform/rest/v3/?utm_source=%2Fcloud%2Fjira%2Fplatform%2Frest%2F&utm_medium=302#api-rest-api-3-project-get

Hope this helps 

banuchandra July 12, 2023

Hi Team,

Am trying to assign a ticket from the jenkins to jira using jira pipeline steps 
jiraAssignIssue idOrKey: "TEST-3", site: 'jira', userName: "banuchandra"
when am trying above code getting below error

Error Code: 400
Error Message: {"errorMessages":["'accountId' must be the only user identifying query parameter in GDPR strict mode."],"errors":{}}
banuchandra July 12, 2023

can someone pls help on this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events