You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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))