Skip to main content

Get-AtriaApiContext

SYNOPSIS

Gets the current context of the Atria API connection.

SYNTAX

Get-AtriaApiContext [<CommonParameters>]

DESCRIPTION

Returns a hashtable containing the authentication token, API base URI, connected user, roles, and connection status.

The connection status (connected) indicates whether the session has an active authentication token.

PARAMETERS

<CommonParameters>

This cmdlet supports common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

For more information, see about_CommonParameters.

OUTPUTS

A hashtable with the following keys:

NameTypeDescription
apiAuthTokenStringCurrent bearer token. Treat this value as a secret.
apiBaseUriStringBase URL of the Atria API.
UserNameStringAccount name returned by token validation.
UserLabelStringDisplay label returned by token validation.
RolesCollectionAtria roles returned by token validation.
connectedBooleanWhether a token is currently stored in the module session.

EXAMPLES

Example 1

$context = Get-AtriaApiContext
[pscustomobject]@{
Connected = $context.connected
ApiBase = $context.apiBaseUri
UserName = $context.UserName
UserLabel = $context.UserLabel
Roles = $context.Roles -join ', '
}

Displays a safe summary without printing the apiAuthToken entry.

NOTES

Do not log the complete object

The returned hashtable contains the live bearer token. Select only the non-secret fields needed for diagnostics; do not print, serialize, export, or log the complete context.