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

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.

Cheers,
-David
HipChat Server/DataCenter Support Engineer | Atlassian

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Tuesday in Hipchat

Moving from Hipchat to Stride? Here’s what you’ll love

Heya, Hipchat friends! We’re so happy you’re checking out   Stride. Whether you know it or not, you have been instrumental in making Stride come to life. Every feature, design, and functionality...

134 views 3 8
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