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.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.