Hi all,
I just created a new webhook on Jira that I'm just testing out right now. I just sent this post request to it as a test:
{
"name": "my first webhook via rest",
"url": "http://www.example.com/webhooks",
"events": [
"jira:issue_created",
"jira:issue_updated"
],
"filters": {
"issue-related-events-section": "Project = JRA AND resolution = Fixed"
},
"excludeBody" : false
}
However, this is the response I am getting:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><status> <status-code>401</status-code> <message>Client must be authenticated to access this resource.</message></status>
I didn't set up any authentication requirement on my webhook, so I'm not sure why this is happening or how I can authenticate the client.
Thanks!
Hi @nathan.dunn ,
If I understand correctly you are trying to create a WebHook in Jira Server following the below documentation and you are getting error 401 in return:
If this is correct, then you didn't provide enough information, like:
Now, in order to proceed with this ticket, can you try to send the below request using Curl and see if it works:
curl -D- -u <USERNAME>:<PASSWORD> -H "Accept: application/json" -H "Content-Type: application/json" -d '{"name":"my first webhook via rest","url":"http://www.example.com/webhooks","events":["jira:issue_created","jira:issue_updated"],"filters":{"issue-related-events-section":"Project = JRA AND resolution = Fixed"},"excludeBody":false}' -X POST http://<JIRA-URL>/rest/webhooks/1.0/webhook
Please replace <USERNAME> and <PASSWORD> with your actual username and password and <JIRA-URL> wit the actual url you use to access Jira Server (you may also want to use HTTPS instead of HTTP if available).
In case this does not work, please paste the output of the command in your reply making sure you remove the sensitive data (username, password, url, etc).
Also, in case this is not what you are trying to do please provide as many details as possible.
Cheers,
Dario
Hi, thank you for the response.
This was what I got back when I used that curl:
HTTP/1.1 301 Moved Permanently
Content-Type: text/html
Date: Wed, 24 Jul 2019 23:33:42 GMT
Location: https://webhooks.atlassian.net/rest/webhooks/1.0/webhook
Connection: Keep-Alive
Content-Length: 0
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @nathan.dunn ,
Thanks for your quick reaction on this. I managed to get the same status code and the problem is that in the example I provided I was using HTTP instead of HTTPS for both, the instance URL and the WebHook URL.
I have modified the command as below and I can confirm it works as expected:
curl -D- -u <USERNAME>:<PASSWORD> -H "Accept: application/json" -H "Content-Type: application/json" -d '{"name":"my first webhook via rest","url":"https://www.example.com/webhooks","events":["jira:issue_created","jira:issue_updated"],"filters":{"issue-related-events-section":"Project = JRA AND resolution = Fixed"},"excludeBody":false}' -X POST https://<INSTANCE>/rest/webhooks/1.0/webhook
HTTP/2 201
server: AtlassianProxy/1.15.8.1
cache-control: no-cache, no-store, no-transform
content-type: application/json;charset=UTF-8
[REMOVED]
[...]
{"name":"my first webhook via rest","url":"https://www.example.com/webhooks","excludeBody":false,"filters":{"issue-related-events-section":"Project = JRA AND resolution = Fixed"},"events":["jira:issue_updated","jira:issue_created"],"enabled":true,"payloadVersion":"V2","self":"https://XXXXXXX.atlassian.net/rest/webhooks/1.0/webhook/4","lastUpdatedUser":"dxxxxxxx","lastUpdatedDisplayName":"Dario XXXXXX","lastUpdated":1564067318116}
Can you please modify the provided curl command to use HTTPS as shown above and confirm this works for you as well (paste the output otherwise)?
Cheers,
Dario
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.