RESTful/scratch.ps1
$Header = @{} function __connect__ { param ( [string]$ComputerName, [pscredential]$Credential ) $Body = @{ 'name' = $Credential.UserName 'password' = $Credential.GetNetworkCredential().Password } $Auth = Invoke-RestMethod -Uri http://$ComputerName/api/v1/authentication/signin -Method Post -ContentType application/json $Header.token = $Auth.token #$Header.goodUntil = $Auth ### Want to figure out how to ensure the credentials arenet expired } function __isExpired__ ($Header) { ### How do I know if the token is good? } function __testConnection__ (OptionalParameters) { } |