Test-RelativityConnection
  • 1 Minute to read
  • Dark
    Light
  • PDF

Test-RelativityConnection

  • Dark
    Light
  • PDF

Article summary

Relativity Integration Required

This cmdlet requires a valid Relativity integration in order to work. See the Relativity integration documentation to learn how to set up the integration.

Summary

Tests a Relativity integration and returns true or false if the test succeeds or not.

Test-RelativityConnection
    -IntegrationId
    -ThrowException

Returns a boolean value.

Parameters

Parameter

Type

Required?

Notes

IntegrationId

Int32

Yes

The integration id.

ThrowException

Switch

No, defaults to false

If set to true, the cmdlet will throw an exception instead of returning false for a failed connection test.

Examples

Test the connection to Relativity

# Your Relativity base URL
relativityUrl = "https://my-company.relativity.one"

# Retrieve the Relativity integration based on the Relativity URL to get the integration id needed
$integrations = Get-Integrations `
    -Filter "Name eq 'Relativity' and startswith(Identifier,'$relativityUrl')"

$relativityIntegration = $integrations.Collection | Select-Object -First 1

if ($null -eq $relativityIntegration) {
    Write-Error "Unable to find a Relativity integration with the identifier `"$relativityIdentifier`""
    exit
}

# Test the Relativity connection. The `Test-RelativityConnection` cmdlet returns true
# or false depending on if the connection is successful or not.
$relativityConnectionTestSuccessful = Test-RelativityConnection `
    -IntegrationId $relativityIntegration.IntegrationId

if (-not $relativityConnectionTestSuccessful) {
    Write-Error "Unable to connect to Relativity instance $relativityUrl"
    exit
}

Write-Output "Successfully tested the connection to Relativity instance $relativityUrl"

Output of this script:

Successfully tested the connection to Relativity instance https://my-company.relativity.one