Relativity.API.Extensions
20.0.2
dotnet add package Relativity.API.Extensions --version 20.0.2
NuGet\Install-Package Relativity.API.Extensions -Version 20.0.2
<PackageReference Include="Relativity.API.Extensions" Version="20.0.2" />
<PackageVersion Include="Relativity.API.Extensions" Version="20.0.2" />
<PackageReference Include="Relativity.API.Extensions" />
paket add Relativity.API.Extensions --version 20.0.2
#r "nuget: Relativity.API.Extensions, 20.0.2"
#:package Relativity.API.Extensions@20.0.2
#addin nuget:?package=Relativity.API.Extensions&version=20.0.2
#tool nuget:?package=Relativity.API.Extensions&version=20.0.2
Relativity.API.Extensions
This library provides extension methods for the IServicesMgr interface for connecting multi-tenant microservices. It includes the following methods:
- GetInstanceBaseURL
- Returns the Base Url and port if specified from the
Relativity.Core::RestServicesUriInstance-Setting of the tenant as a string.
- Returns the Base Url and port if specified from the
- GetHttpAuthorizationHandler
- Returns a DelegatingHandler that automatically adds Authorization headers for HTTP calls. This method takes in
Relativity.API.ExecutionIdentityas an input.
- Returns a DelegatingHandler that automatically adds Authorization headers for HTTP calls. This method takes in
Installing via the .NET SDK
dotnet add package Relativity.API.Extensions
Developer Setup
Usage
Users will need to include the Extensions assembly in their ADS applications. The GetInstanceBaseURL and GetHttpAuthorizationHandler can be called using the snippet below:
using Relativity.API.Extensions;
public class AgentBaseTest : AgentBase
{
private IServicesMgr _servicesMgr;
public AgentBaseTest()
{
}
public override string Name => "AgentBaseTest";
public override void Execute()
{
_servicesMgr = Helper.GetServicesManager();
// Get the auth handler
// See advanced usage for setting an inner handler
var authHandler = _servicesMgr.GetHttpAuthorizationHandler(ExecutionIdentity.CurrentUser);
var client = new HttpClient(authHandler);
var requestUrl = GetRequestUrl("/api/test-endpoint");
var request = new HttpRequestMessage(HttpMethod.Get, requestUrl);
var response = client.SendAsync(request).Result;
}
private Uri GetRequestUrl(string requestEndpoint)
{
var baseUrl = _servicesMgr.GetInstanceBaseURL();
if (string.IsNullOrEmpty(baseUrl))
{
throw new InvalidOperationException("Base URL is not set.");
}
var fullUri = new Uri(new Uri(baseUrl), requestEndpoint);
return fullUri;
}
}
Advanced Usage: Setting the InnerHandler
If you want to chain additional handlers or use a custom HttpClientHandler, set the InnerHandler property before passing the handler to HttpClient:
var authHandler = _servicesMgr.GetHttpAuthorizationHandler(ExecutionIdentity.CurrentUser);
authHandler.InnerHandler = new MyCustomHandler(); // or new HttpClientHandler()
var client = new HttpClient(authHandler);
If you do not set InnerHandler, a default HttpClientHandler will be used.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETFramework 4.6.2
- Relativity.API (>= 20.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 20.0.2 | 942 | 10/7/2025 |