Follow

Elvis 6 REST API - logout

Comments

1 comment

  • Avatar
    Michael Drozdek

    With Powershell this code works:

    Took me a while to figure it out. Maybe someone needs it.

    $token = ""

    $urlLogin = 'http://<elvisserver>/services/apilogin?
    cred=<base64 credentials>
    &username=<user>
    &password=<password>'

    $urlLogout = 'http://<elvisserver>/services/logout'


    $responseLogin = Invoke-RestMethod -Method 'Post' -Uri $urlLogin

    $token = $responseLogin.authToken

    $headers = @{
    'Content-Type' = 'application/json'
    'Authorization' = ''
    }
    $headers.'Authorization' = 'Bearer ' + $token

    $headers

    $responseLogout = Invoke-RestMethod -Method 'Post' -Headers $headers -Uri $urlLogout

    Write-Host $responseLogout

Please sign in to leave a comment.