Retrieves the user who is on-call for the specified schedule at a given time.
This endpoint requires the on_call_read permission.
Arguments
Path Parameters
Name
Type
Description
schedule_id [required]
string
The ID of the schedule.
Query Strings
Name
Type
Description
include
string
Specifies related resources to include in the response as a comma-separated list. Allowed value: user.
filter[at_ts]
string
Retrieves the on-call user at the given timestamp in RFC3339 format (for example, 2025-05-07T02:53:01Z or 2025-05-07T02:53:01+00:00). When using timezone offsets with + or -, ensure proper URL encoding (+ should be encoded as %2B). Defaults to the current time if omitted.
"""
Get scheduled on-call user returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.on_call_apiimportOnCallApi# there is a valid "schedule" in the systemSCHEDULE_DATA_ID=environ["SCHEDULE_DATA_ID"]configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=OnCallApi(api_client)response=api_instance.get_schedule_on_call_user(schedule_id=SCHEDULE_DATA_ID,)print(response)
# Get scheduled on-call user returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::OnCallAPI.new# there is a valid "schedule" in the systemSCHEDULE_DATA_ID=ENV["SCHEDULE_DATA_ID"]papi_instance.get_schedule_on_call_user(SCHEDULE_DATA_ID)
// Get scheduled on-call user returns "OK" responsepackagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){// there is a valid "schedule" in the systemScheduleDataID:=os.Getenv("SCHEDULE_DATA_ID")ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewOnCallApi(apiClient)resp,r,err:=api.GetScheduleOnCallUser(ctx,ScheduleDataID,*datadogV2.NewGetScheduleOnCallUserOptionalParameters())iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `OnCallApi.GetScheduleOnCallUser`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `OnCallApi.GetScheduleOnCallUser`:\n%s\n",responseContent)}
// Get scheduled on-call user returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.OnCallApi;importcom.datadog.api.client.v2.model.Shift;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();OnCallApiapiInstance=newOnCallApi(defaultClient);// there is a valid "schedule" in the systemStringSCHEDULE_DATA_ID=System.getenv("SCHEDULE_DATA_ID");try{Shiftresult=apiInstance.getScheduleOnCallUser(SCHEDULE_DATA_ID);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling OnCallApi#getScheduleOnCallUser");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get scheduled on-call user returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_on_call::GetScheduleOnCallUserOptionalParams;usedatadog_api_client::datadogV2::api_on_call::OnCallAPI;#[tokio::main]asyncfnmain(){// there is a valid "schedule" in the system
letschedule_data_id=std::env::var("SCHEDULE_DATA_ID").unwrap();letconfiguration=datadog::Configuration::new();letapi=OnCallAPI::with_config(configuration);letresp=api.get_schedule_on_call_user(schedule_data_id.clone(),GetScheduleOnCallUserOptionalParams::default(),).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get scheduled on-call user returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.OnCallApi(configuration);// there is a valid "schedule" in the system
constSCHEDULE_DATA_ID=process.env.SCHEDULE_DATA_IDasstring;constparams: v2.OnCallApiGetScheduleOnCallUserRequest={scheduleId: SCHEDULE_DATA_ID,};apiInstance.getScheduleOnCallUser(params).then((data: v2.Shift)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));