Walk-Through Using the .NET Data API Test Harness Sample Code

The sample code for the Data API can be extracted from the following location on your Crestron Fusion server: <install drive>\Program Files\Crestron\Crestron Fusion\FSM\API_Samples\ API_NET_Samples.zip.

Follow the steps below to run the .NET test harness and inspect the code at runtime.

  1. Navigate to the Samples folder on the Crestron Fusion Server and open the ApiTestHarnessMicrosoft subfolder.
  2. Double-click ApiTestHarnessMicrosoft.sln to open the test harness in Visual Studio. Change the web.config app setting ServiceURL to the path of the ApiService installed in the development environment.

  3. Open the HTTPHelper class in the Helpers folder of the ApiTestHarnessMicrosoft project. Refer to the application of the .NET classes in Creating an API Client Using Microsoft .NET. Set a breakpoint on the first line of each function.

  4. Open the XMLHelper class in the ApiHelper project. Note the application of the XMLSerializer, which has functions to both serialize and deserialize XML.

  5. Set a breakpoint on the first line of each function, from the Model objects contained in the Entities folder of the ApiHelper project.

  6. Click Run and then click Login.

    NOTES: Crestron Fusion API configuration must be set to use security with no encryption as described in Security Options.
  7. Click the Test All tab and then click Test All. Advance through the code while inspecting the objects in the Watch window.