Youtube2Pisignage/pisignage.ps1

30 lines
835 B
PowerShell

# Define PiSignage API endpoint and credentials
$piSignageAPIUrl = "https://cybertek.pisignage.com/api/session"
$email = "cole@cybertek.systems"
$password = "(OB4,k6@[{8}t#?M0}FD"
# Convert payload to JSON format
$payload = @{
email = $email
password = $password
getToken = "True"
} | ConvertTo-Json
# Set content type to JSON
$headers = @{
'Content-Type' = 'application/json'
}
# Send the POST request to retrieve the token
$response = Invoke-RestMethod -Uri $piSignageAPIUrl -Method Post -Headers $headers -Body $payload
# Extract the token from the response
$apiToken = $response.token
# Add token to headers for future requests
$headers['x-access-token'] = $apiToken
# Display token for verification
Write-Output "API Token: $apiToken"
Write-Output "Headers with token: $headers"