Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid request payload when trying to add actors to project

Adrian Rolka
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!
February 15, 2023

Hey , I'm trying to add people as agents to particular service desk and after resolving bunch of problems with authentication etc i finally stumbled upon 

['Invalid request payload. Refer to the REST API documentation and try again.']}

 

My guess would be that 

data = {"accountId": account_id} is somehow wrong and maybe something else needs to be used. Seems that the projectID, roleID and accountId are all printed and correct for e-mail i'm using. 

 

Block of code making the request: 

 

# Make an API request to add the agent to the project
add_url = f'{jira_url}/rest/api/latest/project/{ProjectID}/role/{RoleID}'
headers = {'Content-Type': 'application/json'}
data = {"accountId": account_id}
add_response = requests.post(add_url, auth=auth, headers=headers, data=json.dumps(data))

1 answer

1 accepted

0 votes
Answer accepted
Adrian Rolka
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!
February 19, 2023

It was indeed 

data = {"accountId"account_id

What was needed is to transform it to array so the correct way is 

data = {"accountId": [account_id]}

Suggest an answer

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

Atlassian Community Events