I want to use automation to send a REST API - in automation language a Send web request action - but I need to be able to authenticate using an API Key from the receiving platform.
Here's the authentication documentation from the receiving platform:
How can I insert this API key in the automations Send web request?
Hi @Ward Schwillens_ Schwillie,
"-u" is curl's way of specifying Basic Authorization. There is an article explaining how to achieve this in detail here:
To summarise for your case, you'll want to Base64 encode your "<username>:<password>" by running:
echo -n "abcdefghij1234567890:X" | base64
(or an equivalent base64 encoding tool)
and then adding a header to your Web Request with:
Key: Authorization
Value: Basic <your_base64_encoded_output_from_above>
I hope this helps!
Thank you for explaining Stephen. I found a base 64 encoding tool to do this for me.
Best regards, Ward.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Ward Schwillens_ Schwillie
As @Stephen Wrathall mention you need a base64 auth token generated based on the username and password, I'm not the biggest fan of curl but can provide a Powershell script that will provide the authtoken.
$atlassianUsername = <Username>
$atlassianPassword = <Password>
$atlassianAuthToken = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("$($atlassianUsername):$($atlassianPassword)"))
Once you've got that you're able to use the authtoken in a Jira Automation Send Webrequest.
You have to change the web request URL to match what your looking for and the HTTP method to match the endpoint.
Once you get a response you'll have to handle it some how, this is how the above web request is being managed to create a variable for the user. I placed the response in a variable to be able to reuse it throughout the automation.
I hope I managed to give you some insight in how you possible could work with the web request.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Tony Langlet. Minor note that:
applicaiton/json
needs to change to:
application/json
for the "Accept" header in your screenshot.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, I've updated the screenshot, I copied data from a production automation to a test automation and thought my accuracy was good enough to write one word :D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Tony,
I found another way to generate the base64 encoded auth token based on the username and password. The basic authentication with the API key and the "X" worked fine.
I'm now updating freshservice tickets with this API call when specific updates occur in the Jira issue.
Best regards, Ward
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.