I am trying to make a REST call in an Automation to the Organizations API to retrieve information about a user.
My URL looks like this:
https://api.atlassian.com/admin/v2/orgs/<org_id>/directories/-/users?searchTerm=<email>
I have removed the org_id and email for obvious reasons
When I put this URL into Postman, it works as expected. When I put the URL into "Send Web Request" action in A4J, I get an "Invalid web request url" error.
Any ideas why it fails in A4J but works in Postman?
I went to open a ticket with Atlassian and, amazingly, the AI led me to the answer. I'm not exactly sure of what is happening in the back end. It appears that the back-end is performing a URL encoding of the search parameters after getting the URL. However, even passing in the unencoded email string (abc@def.com) didn't work.
I modified the URL to be
https://api.atlassian.com/admin/v2/orgs/<orgId>/directories/-/users?searchTerm={{#urlEncode}}<email>{{/}}
This worked. I suspect that the URL-encoder in the back-end is ignoring the smart value that is passed. So, it URL-encodes only query parameters that are not inside a smart value block. This doesn't explain why passing in the unencoded string didn't work.
Hello @Derek Fields _RightStar_
Can you provide a link to the endpoint documentation? I'm not finding an endpoint that uses "searchTerm"
https://developer.atlassian.com/cloud/admin/organization/rest/api-group-users/#api-group-users
Are you using a smart value to insert the email into the endpoint? If so did you encode the value?
Can you provide a screen images of the Send web request acton?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Trudy Claspill - Documentation is The Organizations REST API REST API - you need to unhide the extra parameters to see the searchTerm option. I hardcoded the URL into the Web Request action exactly as it works in Postman including the escaped characters.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is a deja vu situation. Postman works just fine but not within A4J which always makes me think that either a configuration at the server level or Jira are the blockers.
May be a good question for other champions in slack.
Best,
Fadoua
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Tinker Fadoua - I thought of posting on Slack. I thought that this forum would get more views from a wider audience.
I agree that there is probably something going on in the A4J implementation. I will open a bug report with Atlassian.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.