Secret Server Webservices can be called using scripts. This example demonstrates how to authenticate and retrieve Secrets and Folders programatically in
C#. There is also a detailed
PHP example script and
Perl example script.
This is a working example for Secret Server Online; add your own account username, org code, and password to run it. To use this code, a WebReference named SSWebService must be added to the Visual Studio project for
https://www.secretserveronline.com/webservices/SSWebService.asmx.
If connecting to an Installed instance change the web reference URL to match your site and pass in an empty string for organizationCode.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SecretServerWebServices
{
class Program
{
public const string Username = "your username";
public const string Organization = "your org code";
public const string Password = "your password";
static void Main(string[] args)
{
using (var service = new SSWebService.SSWebService())
{
//secrets
var token = service.Authenticate(Username, Password, Organization, null);
var secrets = service.SearchSecrets(token.Token, ""); //find all Secrets
foreach (var secret in secrets.SecretSummaries)
{
Console.WriteLine("{0}: {1}", secret.SecretName, secret.SecretTypeName);
}
//folders
var folders = service.SearchFolders(token.Token, ""); //find all folders
foreach (var folder in folders.Folders)
{
Console.WriteLine("{0}: {1}", folder.Name, folder.Id);
}
}
Console.WriteLine("Folders Found");
Console.ReadKey();
}
}
}
Article ID: 154, Created On: 4/11/2011, Modified: 3/27/2013