Getting started
To use the Citrix Cloud Connector maintenance schedule APIs, Citrix customers must have the following in each API request:
-
Citrix CustomerID: CustomerId is passed in the
Citrix-CustomerId
header. -
CCAuth Token: Secure HTTP requests sent to Citrix Cloud (CC) use a custom
Authorization header
that contains a CC bearer token. Bearer tokens are required for actions that take place on behalf of a user.
To get the customer ID and bearer token, see the Get started with Citrix Cloud APIs section.
Use the REST APIs to create, query, update, and remove specific connector maintenance schedules in resource locations in Citrix Cloud.
Get all connector maintenance schedules
This demonstrates how to issue a REST request to retrieve all the connector maintenance schedules across all customer resource locations.
Request
GET https://api.cloud.com/maintenance/
Authorization: CWSAuth bearer=<Token>
Accept: application/json
Citrix-CustomerId: <CustomerId>
<!--NeedCopy-->
Note:
Replace CustomerId in the preceding request with the ID of the customer you wish to query.
Response
HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
Citrix-TransactionId: 9e585bbd-e870-4e81-a308-dbd6e8ae66f8
Date: Mon, 27 Mar 2023 14:43:07 GMT
[
{
"location": "847daa2f-d6bf-42bf-977a-537250dcaec0",
"dayOfWeek": "Friday",
"start": "12:00:00",
"order": "Early"
}
]
<!--NeedCopy-->
C# example
The following REST example illustrates how to get all connector maintenance schedules using C#.
public static async Task<IEnumerable<MaintenanceModel>> GetMaintenanceSchedules(string bearerToken,
string customer)
{
var client = new HttpClient();
client.DefaultRequestHeaders.Accept.ParseAdd("application/json");
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("CwsAuth", "Bearer=" + bearerToken);
client.DefaultRequestHeaders.Add("Citrix-CustomerId", customer);
var response = await client.GetAsync("https://api.cloud.com/maintenance" );
response.EnsureSuccessStatusCode();
var content = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<IEnumerable<MaintenanceModel>>(content);
}
public sealed class MaintenanceModel
{
/// <summary>
/// Resource location
/// </summary>
public string Location { get; set; }
/// <summary>
/// The day of the week
/// </summary>
public MaintenanceDayOfWeek DayOfWeek { get; set; }
/// <summary>
/// Start time
/// </summary>
public TimeSpan Start { get; set; }
}
<!--NeedCopy-->