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,556,162
Community Members
 
Community Events
184
Community Groups

Adding data to metric returns status code 400 (+ docs wrong)

Edited

I am trying to add data to metric, but i am getting in response Status Code 400, which is not listed in docs


Here's some code: (based on script on data submit page)

Python 3

# need 1 data point every 5 minutes
# submit random data for the whole day
total_points = int((60 / 5 * 24))
for i in range(total_points):
ts = int(time.time()) - (i * 5 * 60)
value = random.randint(0, 99)
params = json.dumps(
{
"data": {
"timestamp": 0,
"value": 0
}
}
)
headers = {'Content-Type': 'application/json', 'Authorization': f'Bearer {api_key}'}
r = requests.post(
f'https://api.statuspage.io/v1/pages/{page_id}/metrics/{metric_id}/data',
params=params,
headers=headers)
# response = r.status_code


if (r.status_code >= 400):
genericError = "Error encountered. Please ensure that your page code and authorization key are correct."
print(genericError)
print(f'Status code = {r.status_code}')
print(f'Attempt no.{str(i + 1)}')
else:
print("Submitted point " + str(i + 1) + " of " + str(total_points))

 

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events