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

Having Problem with Tempo api Holiday schemes

Hi all I'm trying to set up our holiday schemes via the api, specifically setting up a new holiday.

I've tried to follow the documentation shown here: https://help.tempo.io/cloud/en/tempo-server-migration-guide/rest-apis-for-your-migration/rest-apis-for-jira-cloud/workload-and-holiday-scheme-rest-apis-for-jira-cloud.html

 

My code is as follows:

Python:

session = requests.Session()
session.headers.update({'Authorization': f'Bearer {get_tempo_token("w")}',
'Content-Type': 'text/plain'
})
data = {"type": "FIXED", "name": "Christmas Eve", "description": "The day before Christmas",
"durationSeconds": 28800, "date": "2021-12-24"}
headers = {
'Authorization': f'Bearer {get_tempo_token("w")}',
'Content-Type': 'text/plain',
}
response = requests.post('https://api.tempo.io/core/3/holiday-schemes/5/holidays', headers=headers, data=data)

 

curl (just to test my python implementation):

curl --request POST 'https://api.tempo.io/core/3/holiday-schemes/5/holidays' \
-H 'Authorization: Bearer api_token' \
-H 'Content-Type: text/plain' \
--data-raw '{"type": "FIXED","name": "Christmas Eve","description": "The day before Christmas","durationSeconds": 28800,"date": "2021-12-24"}'

 

In both cases I get a 415 error with the message: "Something went wrong. Please try again later. If the error persists, contact our support team."

Digging deeper in python 

response.reason = 'Unsupported Media Type'

 

Any help?

 

Note I'm reasonably confident my authentication is working well as i can use it to get data successfully.

1 answer

1 accepted

0 votes
Answer accepted
Susanne Götz _Tempo_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Mar 31, 2022

Hi @Matt Dumont

Thank you for bringing this to our attention. It looks like the documentation you are referring to is incorrect/outdated and I have informed our technical writers about it.

Can you please try the following and check if this is working. 

curl -X POST "https://api.tempo.io/core/3/holiday-schemes/4/holidays" \
--header "Authorization: Bearer {Access_Token}" \
--header "Content-Type: application/json" \
--data '{"type": "FIXED","name": "Christmas Eve","description": "The day before Christmas","durationSeconds": 28800,"date": "2022-12-24"}'

 
Best regards,
Susanne Götz
Tempo team

changing the header to "application/json" and

 

changing the data (in my python script) from:

data = {"type": "FIXED", "name": "Christmas Eve", "description": "The day before Christmas",
"durationSeconds": 28800, "date": "2021-12-24"}

to

data = '{"type": "FIXED", "name": "Christmas Eve", "description": "The day before Christmas", "durationSeconds": 28800, "date": "2021-12-24"} '

 

worked perfectly.  thanks! 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events