Forums

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

Parameter (accountId) does not match required pattern

Sylvie R_ October 28, 2024

I am retrieving a list of users via the v1/orgs/{org_id}/users/search API.

From that list I extract the accountId and with that call the API

"https://api.atlassian.com/users/"+accountId+")}/manage/profile".

And I get the following answer:

{ "context": { "message": "Request validation failed: Parameter (accountId) does not match required pattern: ^[a-zA-Z0-9_|:-]{1,128}$", "paramName": "accountId", "path": "paths->/users/{accountId}/manage/profile->get->parameters->0" }, "errorDetail": { "message": "Request validation failed: Parameter (accountId) does not match required pattern: ^[a-zA-Z0-9_|:-]{1,128}$", "paramName": "accountId", "path": "paths->/users/{accountId}/manage/profile->get->parameters->0" }, "errorKey": "bad-request-format", "key": "badRequestFormat" }

How can the accountId retrieved via API not be correct?

1 answer

1 accepted

1 vote
Answer accepted
Evgenii
Community Champion
October 29, 2024

Hi, @Sylvie R_ 

Welcome to Atlassian Community

Looking at your url, I think, it's the reason. You included ")} in it.
This is, for example, my script in python, which I use to work with users data

def get_profile(account_id):
url = f"https://api.atlassian.com/users/{account_id}/manage/profile"
response = requests.get(url, headers=admin_headers)
if response.status_code == 200:
return response.json()
else:
pass

 

Also pay attention, that you need to check, that user "accountType" == "atlassian". 

Sylvie R_ October 29, 2024

That was it, I feel a bit stupid not to have spotted it.

Like Evgenii likes this

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