Workspace Environment Management REST APIs

Sample codes of REST APIs for Workspace Environment Management

Follow the sample codes on how to query all defined machine-level AD objects. The sample codes are available in C#, jQuery, OK HTTP, and Python.

C# code

var client = new RestClient("https://api.wem.cloud.com/services/wem/machines");
var request = new RestRequest(Method.GET);
request.AddHeader("Accept", "application/json");
request.AddHeader("Citrix-TransactionId", "ab3e279b-f936-4abe-bfd5-cd24032e66a8");
request.AddHeader("Authorization", "Bearer Your-Bearer-Token");
request.AddHeader("Citrix-CustomerId", "Your-Customer-ID");
IRestResponse response = client.Execute(request);
<!--NeedCopy-->

JavaScript code (JQuery)

// import the JQuery library before running the code below

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.wem.cloud.com/services/wem/machines",
  "method": "GET",
  "headers": {
    "Citrix-TransactionId": "ab3e279b-f936-4abe-bfd5-cd24032e66a8",
    "Accept": "application/json",
    "Authorization": "Bearer Your-Bearer-Token",
    "Citrix-CustomerId": "Your-Customer-ID"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
<!--NeedCopy-->

Java code (OkHttp)

// Import the OkHttp Library before running the code below

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.wem.cloud.com/services/wem/machines")
  .get()
  .addHeader("Citrix-TransactionId", "ab3e279b-f936-4abe-bfd5-cd24032e66a8")
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "Bearer Your-Bearer-Token")
  .addHeader("Citrix-CustomerId", "Your-Customer-ID")
  .build();

Response response = client.newCall(request).execute();
<!--NeedCopy-->

Python code

import http.client

conn = http.client.HTTPConnection("api,wem,cloud,com")

headers = {
    'Citrix-TransactionId': "ab3e279b-f936-4abe-bfd5-cd24032e66a8",
    'Accept': "application/json",
    'Authorization': "Bearer Your-Bearer-Token",
    'Citrix-CustomerId': "Your-Customer-ID"
    }

conn.request("GET", "services,wem,machines", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
<!--NeedCopy-->
Resources
Workspace Environment Management REST APIs OpenAPI Specification
Copy Download
Sample codes of REST APIs for Workspace Environment Management