Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,557,547
Community Members
 
Community Events
184
Community Groups

Lambda Component Update Error 400

Hi,
I am new to Statuspage and I am currently experiencing an error 400 when I try to update a Statuspage component via AWS Lambda.

This is the code for the lambda function I am using:

 

import requests
import json

def post_to_statuspage(payload):

headers = {'content-type': 'application/json', 'Authorization': 'Oauth a31d80fb-xxxxxx-xxxxx0849' }
url = 'https://api.statuspage.io/v1/pages/0b7rflm22xxx/components/q74nxxx8zt7'
return requests.patch(url=url, data=payload, headers=headers)

def package_data(payload):

data = {'event' : payload }
response = post_to_statuspage(json.dumps(data))
return response.status_code

def lambda_handler(event, context):

alerts = event["component"]
status = []
for alert in alerts:
status.append(package_data(alert))

return status



The test event/payload I am using only has the following:

{
"component": {
"status": "under_maintenance"
}
}

Where could the problem be?

2 answers

1 accepted

0 votes
Answer accepted

I figured this out.
I just cleaned up the script.

Does it work when you replace

data = {'event' : payload }
response = post_to_statuspage(json.dumps(data))

with

response = post_to_statuspage(json.dumps(payload))

?

Thanks for this but no it doesn't.
I am already converting to JSON with my package_data.

I did try replacing as suggested but the error still persists.
Any help with this will be appreciated.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events