Room notifications via REST API failing after upgrade from 2.2.3 to 2.2.6 Edited

I have a powershell script that sends a room notification that has been working for quite some time that just started failing with a 405 method not allowed error after our upgrade from 2.2.3 to 2.2.6. Here is the powershell:

# Send HipChat room notification of reboots

#Variables for the json post
$APIKey = '<ourapikey>'

#The key is tied to user who requests it and will post as that person (may want to build an admin user)
$Room = '63' #Case sensitive if using name!! Use ID from the room it's easier

#Hipchat post url variable
$apiuri = "http://<ourhipchatserver>/v2/room/$Room/notification?auth_token=$APIKey”

#Notify defaults to false, change to true for notifications
$body = @{
color =  “red”;
message=  “REBOOTS IN PROGRESS: STAGE Load Controller and Generators”;
notify=  “true”;
message_format= “text”
#Post to room
Invoke-RestMethod -Method Post -Uri $apiuri -body (ConvertTo-Json $body) -ContentType “application/json”
#End of Hipchat Post

Here is the error from powershell, which is reflected in the hipchat log:

Invoke-RestMethod : The remote server returned an error: (405) Method Not Allowed.

Any ideas why this might be happening?

1 answer

0 votes

Hi Parker,

I hope you're doing well. Can you try the following cURL command (substitute your FQDN, API_V2_TOKEN, ROOM_ID and MESSAGE values for the placeholders) and let me know if it's successful?

curl -d '{"color": "red", "message": "<MESSAGE>", "notify": true, "message_format": "text"}' -H 'Content-Type: application/json' 'https://<FQDN>/v2/room/<ROOM_ID>/notification?auth_token=<API_V2_TOKEN>'

Additionally, whenever I was testing, I noticed that if I used _http_ instead of _https_ for the URL, I would always get an NGINX error 301 HTTP in HCS v2.2.6 due to the fact that port 80 automatically redirects to _https_ by default. I'm unsure if Powershell handles this error in a different way, so it's worth noting.

Lastly, log into the HipChat Server command line and tail the /var/log/hipchat/coral.log as this is the service that controls the external API. I'm wondering if there are any further errors logged here as it might provide additional clues.

HipChat Server/DataCenter Support Engineer | Atlassian

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 14, 2018 in Hipchat Cloud

Hipchat Cloud and Stride have reached End of Life (updated)

All good things come to an end - thanks to all our customers and partners who have been along the Hipchat and Stride journey with us.  As of Feb 15th 2019, Hipchat Cloud and Stride have reached ...

32,733 views 7 7
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you