Creating Resource Locations

Getting started

To use Citrix Cloud resource locations 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 Citrix Cloud Resource Locations APIs to create, query and update and remove resource locations in Citrix Cloud.

Get details about the resource locations for a customer

Applications and scripts that interface with Citrix Cloud often need to know the resource locations that the customer has created.

Additionally, in order to silently install Citrix Cloud connectors when you have more than one resource location, the ID of the target resource location must be passed at the command line of the installer. Although this ID is available in the Citrix Cloud user interface, it is sometimes desirable to get this information programmatically.

This demonstrates how to issue a REST request to retrieve all resource locations that the customer has.

Request

GET https://api.cloud.com/resourcelocations
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
Date: Mon, 27 Mar 2023 13:03:50 GMT
Content-Type: application/json;charset=utf-8
Citrix-TransactionId: 0d7e13b5-4c2e-41b8-aca0-f49c891d3ae3

{
  "items": [
    {
      "id": "074a22f3-428a-4094-b827-0e58b724ec83",
      "name": "ResourceLocation1",
      "internalOnly": true,
      "timeZone": "GMT Standard Time",
      "readOnly": false
    },
    {
      "id": "09651fe0-06e1-4ba8-94ce-e20f2973e32f",
      "name": "ResourceLocation2",
      "internalOnly": false,
      "timeZone": "GMT Standard Time",
      "readOnly": false
    },
    ...
  ]
}
<!--NeedCopy-->

C# example

The following REST example illustrates how to get all customer resource locations using C#.

public static async Task<ResourceLocationsResultsModel> GetResourceLocations(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/resourcelocations" );

    response.EnsureSuccessStatusCode();

    var content = await response.Content.ReadAsStringAsync();
    return JsonConvert.DeserializeObject<ResourceLocationsResultsModel>(content);
}  

public class ResourceLocationsResultsModel
{
    /// <summary>
    /// A list of resource locations.
    /// </summary>
    public IEnumerable<ResourceLocationModel> Items { get; set; }
}

public class ResourceLocationModel
{
    /// <summary>
    /// Id used for API calls regarding resource location.
    /// </summary>
    public string Id { get; set; }

    /// <summary>
    /// Resource Location Name
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// Resource Location Connectivity
    /// </summary>
    public bool InternalOnly { get; set; }

    /// <summary>
    /// Time zone
    /// </summary>
    public string TimeZone { get; set; }

    /// <summary>
    /// If true means the resource location is managed by citrix
    /// </summary>
    public bool ReadOnly { get; set; }
}
<!--NeedCopy-->
Resources
Creating Resource Locations OpenAPI Specification
Copy Download
Getting started