I am trying to build what I thought would be a simple automation rule with a web request to obtain the email addresses of the members of a project role (to be used in a later step of the same rule to send that group an email message). Nothing I try works and I have been unable to find the resolution through my own research, so I am hopeful that someone here has experienced the issue and can provide guidance.
I have formatted the request as follows:
URL: https://<OURCOMPANY>.atlassian.net/rest/api/3/project/10019/role/10005/members
Method: GET
Body: {} Empty
Delay execution: Checked
Header: Content-Type = application/json
However, when I provide an issue key from that project and attempt the validate button, it fails with a 404 not found Response and tells me the fist one below in the Response Payload:
If I take the "members" off the end and try, it, it tells me the project is not found, but I know for a fact that I am using the proper project id and role id, which I've shown as the second one below.
(* NOTE - I also tried both versions using project key instead of project id, but that gives the same results.)
{ "message": "null for uri: https://jkseva.atlassian.net/rest/api/3/project/10019/role/10005/members", "status-code": 404 }
{ "errorMessages": [ "No project could be found with id '10019'." ], "errors": {} }
Thanks @Jovin
I tried this though, but am still getting a 404 error. Any further suggestions? Thanks.
Hey @Tim Bonney
Cool I see the issue here with that screenshot! I should have asked for one earlier.
Let me know if anything else is unclear; I've not worked on the iterating over the returned data but give it a shot and if you get stuck I can try take a look later.
See below a screenshot of my config working with appropriate authorization & content-type headers:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks again @Jovin but even after changing application/json to lower case, I am still getting 404 error...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Tim Bonney
Don't forget to change the URL you're using as well. The one you have looks to not exist and the correct ones (get members of a project role) was also linked above.
If you're still having issues send through a new screenshot and we'll troubleshoot some more!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jovin .
Thanks again for all your guidance. When I use the url: https://xyz.atlassian.net/rest/api/3/role/10005/actors, I get a successful response, with a payload of actors, but no actual actors are listed:
{ "actors": [] }
When I use the full url you provided previously, it still gives me a 404 (https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-role-actors/#api-rest-api-3-role-id-actors-get), but I am pretty sure that is because I am supossed to modify the part of the string following the "/rest/v3" with different text specifying my distinct values, but no iteration of that that I have tried works.
So, if I have the basic "actors" call working (but with empty results), what do I now need to change in order to further designate the specific project for which I want to identify the actors associated with that project role?
Thanks again for you guidance! This assistance is GREATLY appreciated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Tim Bonney
On the right track! That URL that gives you no actors is the correct usage, glad we got it authenticated and working. That other URL I provided was simply the documentation so you're on the right track here.
I was off-track though; I gave you the find default actors for the project role, my bad! The correct one you want would be: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-roles/#api-rest-api-3-project-projectidorkey-role-id-get
You just need to change your URL that you're point to in your automation to:
/rest/api/3/project/{projectIdOrKey}/role/{id}
The automation I suggested to iterate over the data would need tweaking to get where you want, but should help provide some basic sguidance!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks again @Jovin
Looks like it was the "/members/" on the tail of my url string that was causing issues.
Now, I'll need to work on the parsing as you suggested, but I may need additional call(s) first because the actor content returned does not include email address.
I'm not sure I'll get the time to work on this today or tomorrow, but whenever I do, I will update this thread to let you know the outcome.
Thank you once again for all your assistance in this process. I really appreciate your willingness to help out a newbie.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
All newbies at some point! Hopefully you've got what you need to keep playing around!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Tim,
Have you tried replacing the 10019 with the key of the project? (e.g. if the issue key is KEY-123 your project key is KEY)? It looks like it's having issues with the numeric id.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Javin.
Yes, unfortunately, I have attempted it both ways but get the same results with either approach.
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.
Sorry Rupa, but no. I am still struggling to figure out why it is happening. As you can see here, I only received one response to this post, but they had misread my original post.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Tim, using a new API key worked for me.
Encoded it using:
echo -n user@example.com:api_token_string | base64
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Rupa. I can try that, but am not sure what you mean...So, from my original post, in the URL string, I would replace "/api/3/", with "/api_token_string | base64"?
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.
Ah @Tim Bonney
I see now - I missed a key thing, you didn't add the Authorization header into the parameters as well.
@Rupa Goyal is correct, you need to create an API key and then encode it as Base64. If you're windows based like me you can follow these:
$Text = "email:token"
$Bytes = [System.Text.Encoding]::UTF8.GetBytes($Text)
$EncodedText = [Convert]::ToBase64String($Bytes)
$EncodedText
Hopefully that helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you @Jovin .
I appreciate both yours and @Rupa Goyal 's assistance!
I apologize for so many questions, but I am still a beginner here.
I think I understand what you are saying. However, with regards to the API token, we are using Jira Cloud, so do I still attempt the process you've indicated, even though this would not be on a local server? I ask because when you say "...via PowerShell on Windows you can ...", it makes me think I am doing this process locally, so am not sure this still applies if our jira instance is in the cloud.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No worries at all, @Tim Bonney , it gave me headaches when I started with APIs too!
So, the API generation is done via the instructions and that's on your Cloud instance. You copy down that API token and do the PowerShell part on your local machine, if you don't have PowerShell, you could try find alternatives for macOS or others by googling "how to encode string as base64".
I wouldn't recommend doing an online tool for it just in case there's a possible security issue!
Then you can input that information into your automation rule, see an example screenshot below:
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.