Create and Manage Secrets

Creating a new Secret

To create a new secret, invoke the /ServerManage/AddDataVaultItemendpoint and pass in the following fields in the body of the request:

ParameterTypeDescription
SecretNameStringThe name of the new secret.
SecretTextStringThe value for the secret.
TypeStringMust be set to text.

For example:

POST /ServerManage/AddDataVaultItem

{
	"SecretName":"Test",
	"SecretText":"Test12345",
	"Type":"Text"
}

The response contains the GUID for the new secret.

Getting the Contents of a Secret

To get the contents of a secret, invoke the /ServerManage/RetrieveDataVaultItemContents endpoint passing in the ID of the secret. The ID is the GUID for the secret that was returned when it was created. For example:

POST /ServerManage/RetrieveDataVaultItemContents

{
	"ID" : "1234b458-a7b7-12334-9d1a-393e94291234"
}

The secret can also be queried using a Redrock Query passed in via a Script field:

POST /ServerManage/RetrieveDataVaultItemContents

{
	"Script":"SELECT * FROM (Select * FROM DataVault ORDER BY SecretName COLLATE NOCASE)","Args":
	{
		"PageNumber":1,
		"PageSize":100,
		"Limit":100000,
		"SortBy":"",
		"direction":"False",
		"Caching":-1
	}
}

The response contains a Result field with the following fields that specify the secret information: SecretName, SecretText, and Type:

{
	"Errorcode":null,
	"ErrorID":null,
	"Exception":null,
	"InnerExceptions":null,
	"MessageID":null,
	"Result":
	{
		...
		"SecretName":"Test",
		"SecretText":"Test12345",
		"Type":"Text"
		...
	}
}

Creating a New Set

To create a new set invoke the /Collection/CreateManualCollection endpoint and pass in the following fields in the body of the request:

ParameterTypeDescription
ObjectTypeStringSet to DataVault.
addQueryStringThe Redrock query to collate the secrets to be added.
NameStringThe name for the new set.
CollectionTypeStringSet to ManualBucket.
membersObjectAn object containing the field id which is the ID of the member, IsFavorite which specifies true/false for whether the item is a favorite, Type which must be set to text, SecretName which contains the secret, and ID which is the GUID of the secret.

For example:

{
	"ObjectType":"DataVault",
	"addQuery":"Select * FROM DataVault ORDER BY SecretName COLLATE NOCASE",
	"Name":"NewTestSet",
	"CollectionType":"ManualBucket",
	"members":
	[
		{
			"id":"470",
			"IsFavorite":false,
			"Type":"Text",
			"SecretName":"Test",
			"ID":"e793b458-a7b7-4805-9d1a-393e942911c1"
		}
	]
}

The JSON returned contains a result with the GUID for the new item.

Adding a Secret as a Member of a Set

To add a secret as a member of a set, invoke the /Collection/UpdateMembersCollection endpoint and pass in the following fields in the body of the request:

ParameterTypeDescription
idStringThe GUID of the set that was returned when it was created.
addObjectAn object containing the MemberType which must be set to Row, the Table which must be set to DataVault, and Key which is the GUID for the secret.
{
	"id":"8c9cb36d-6877-451f-9abe-a79ab5fac70b",
	"add":
	[
		{
			"MemberType":"Row",
			"Table":"DataVault",
			"Key":"e793b458-a7b7-4805-9d1a-393e942911c1"
		}
	]
}

The response contains a Success field that will be set to true or false.