Composable has an API for every action that you can perform through its UI. All services are documented here: https://dev.composable.ai/api/CompAnalytics.IServices.html
Below is an example script for executing operations on the UserService.
The first part of the script loads the necessary dlls from the SDK. These dlls can be copied from your Composable installation directory.
Next, we create the connection settings. You need to specify the Uri of the Composable instance, the type of authentication method you want to use (Form, Windows, Hybrid, or API), and the actual credentials.
Next, we create the service channel. This is a little messy since earlier versions of Powershell don’t support generic methods nicely, so we have to use reflection.
Finally, we call the operations on the channel. In this case, we’re calling GetCurrentUser to get information about the current / calling user.
Using namespace CompAnalytics.Contracts;
Using namespace CompAnalytics.IServices.Deploy;
Using namespace System;
Using namespace System.Collections.Generic;
Using namespace System.Linq;
$contracts = $PSScriptRoot + "\CompAnalytics.Contracts.dll";
$iservices = $PSScriptRoot + "\CompAnalytics.IServices.dll";
$core = $PSScriptRoot + "\CompAnalytics.Core.dll";
[System.Reflection.Assembly]::LoadFrom($contracts);
[System.Reflection.Assembly]::LoadFrom($iservices);
[System.Reflection.Assembly]::LoadFrom($core);
$connectionSettings = [ConnectionSettings]@{
Uri = New-Object System.Uri("http://localhost/CompAnalytics/");
AuthMode = [AuthMode]::Form;
FormCredential = New-Object System.Net.NetworkCredential("admin", "fakepassword");
};
$resourceManager = New-Object CompAnalytics.IServices.Deploy.ResourceManager($connectionSettings);
[Type[]]$types = ([string],[bool])
$createChannelMethod = [ResourceManager].GetMethod("CreateAuthChannel", $types )
$createChannel = $createChannelMethod.MakeGenericMethod([CompAnalytics.IServices.IUserService])
$userService = $createChannel.Invoke($resourceManager, @("UserService", $true))
$user = $userService.GetCurrentUser();
Write-Output $user
//output
UserId : xxxxxxx
Id : xxx
UserName : admin
FirstName : My Name
LastName : My Last Name
Organization : Cool Company
Email : admin@localhost.com
RequiresPasswordReset : False
Theme : Blue Light



