Having Problem with Tempo api Holiday schemes

Matt Dumont March 30, 2022

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.
March 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

Matt Dumont March 31, 2022

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