Public/Get-SyncHrAuthHeader.ps1

function Get-SyncHrAuthHeader
{
    [CmdletBinding(PositionalBinding=$false)]
    param
    (
        [Parameter(Mandatory=$false)][string]$BaseUrl = 'https://clients.synchr.com/synchr',
        [Parameter(Mandatory=$true)][string]$Username,
        [Parameter(Mandatory=$true)][string]$Password,
        [Parameter(Mandatory=$true)][string]$ApiKey
    )

    $body = @{
        credentials = @{
            user = $Username
            password = $Password
            apiKey = $ApiKey
        }
    } | ConvertTo-Json

    $url = "$BaseUrl/api/1.0/authentication/createToken"
    
    $header = @{
        'Content-Type' = 'application/json'
    }
    
    Write-Verbose "POST: $url"

    $response = Invoke-RestMethod -Method: POST -Uri $url -Body $body -Headers $header

    if ($response.token.Length -gt 5)
    {
        return @{
            Authorization = "SHR apiKey=""$ApiKey""hash=""$($response.token)"""
        }
    }
    else
    {
        return $null
    }

}