Get Schedule of a team in Opsgenia

Sheher Yar September 19, 2023

Hi, I am trying to get the schedule of a team for specific dates lets suppose 27 of the last month to 27 of the current month so I apparently use the month parameter and I add the date for some reason I always get the result from 31 for the previous month to next month is there a technical limitation that we can set custom dates from a specific date to a specific date.

Screen Shot 2023-09-20 at 2.08.45 pm.png

1 answer

1 accepted

1 vote
Answer accepted
Animesh Singh
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 21, 2023

Hello,

Greetings!

Thank you for reaching Atlassian. I have tested the behaviour that you have mentioned and yes by design the API returns data in a period of "Week to date" a "month to date" and "year to date" which results in you seeing it returning the start and end dates as the ones you have correctly mentioned.

However, as your requirement is to get the results of a 30-31 day (a month) time frame, you can make use of interval, intervalUnit=days and specify the startDate to get the desired results.

Here is an example for the same (I am just filtering out the startDate and the endDate for the entire data this method lists out),

# curl --silent -X GET 'https://api.opsgenie.com/v2/schedules/SCHEDULE_ID/timeline?interval=31&intervalUnit=days&date=2023-08-21T00:00:00%2B00:00' --header 'Authorization: GenieKey Your_API_Key_here' | jq '.data.startDate, .data.endDate'

"2023-08-21T00:00:00Z"
"2023-09-21T00:00:00Z"

I hope this helps and I wish you an amazing day ahead!

Best Regards,

Animesh 

Cloud Support Engineer

Sheher Yar September 23, 2023

Hi Animesh your answer worked for me however adding to above I have a small query is it possible to define a range to get schedule like If i want to get schedule from 2023-08-21T00:00:00Z to specifically 2023-08-23T00:18:00Z so for 2 days and some hours till 23/08/2023 till 6pm can we define a boundry in the api call such that i porvide a startv date and end date and get the roster i think current intervals are day , date , month and in documentation there isn't mention an end date parameter. 

Animesh Singh
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 25, 2023

Hello again,

Hope you are doing great. Your usecase is as I understand to get schedules for 2 days and 18 minutes of timeline as an example. You are correct the interval unit is as mentioned below,

{"message":"intervalUnit should be one of [days, weeks, months]","took":0.008,"requestId":""}

Which means for getting the schedule for 18 minutes on top of day 2, you will be needing to get the schedule timeline for the 3 days and then go ahead and filter the information as required.

I hope this helps and have a great day ahead!

Regards,

Animesh

Cloud Support Engineer

Suggest an answer

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

Atlassian Community Events