From dd49390aa00cd01bbb9ca7edfcd28a39c4cae156 Mon Sep 17 00:00:00 2001 From: Erik Date: Tue, 9 Apr 2024 16:30:03 -0600 Subject: [PATCH] success! --- Ajera-ListProjects.ps1 | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Ajera-ListProjects.ps1 b/Ajera-ListProjects.ps1 index 1b2edd3..0f5e285 100644 --- a/Ajera-ListProjects.ps1 +++ b/Ajera-ListProjects.ps1 @@ -3,7 +3,7 @@ https://help.deltek.com/Product/Ajera/api/projects.html#messages-api-endpoint-po #> -$MPE_Ajera_URI = "https://192.168.2.19/ajera/AjeraAPI.ashx" +$MPE_Ajera_URI = "https://ajera.mpe.ca/ajera/AjeraAPI.ashx?ew0KICAiRGF0YWJhc2VOYW1lIjogIkFqZXJhIg0KfQ%3d%3d" $Headers = @{ 'Content-Type' = 'application/json' Accept = 'application/json' @@ -13,15 +13,13 @@ function Connect-Ajera { $Session_Body = @{ Method = "CreateAPISession" Username = "MMIntegration" - Password = "DeluxeMXD74!" + Password = "@s0Nny2day" APIVersion = 2 UseSessionCookie = $false } | ConvertTo-Json - - $session_token_URI = $MPE_Ajera_URI + '?' + $MPE_Ajera_API_Token - $Session_token = Invoke-WebRequest -Uri $session_token_URI -Method Post -Body $Session_Body -Headers $Headers -SkipCertificateCheck + $Session_token = Invoke-WebRequest -Uri $MPE_Ajera_URI -Method Post -Body $Session_Body -Headers $Headers -SkipCertificateCheck return $Session_token } @@ -43,20 +41,20 @@ function Disconnect-Ajera { if (!($APIKey)) { # get session api key if not already loaded $Session = Connect-Ajera - $APIKey = ($Session.Content | ConvertFrom-Json).UsageKey + $resp = $Session.Content | ConvertFrom-Json + $APIKey = $resp.Content.SessionToken } -$API_URI = $MPE_Ajera_URI + '?' + $APIKey $req_body = @{ - Method = 'GetProjects' + Method = 'ListProjects' SessionToken = $APIKey MethodArguments = @{ - FilterByStatus = '["Active", "Hold"]' + FilterByStatus = @("Active") } } | ConvertTo-Json -$resp = Invoke-WebRequest -Uri $API_URI -Headers $Headers -Body $req_body -Method Post -SkipCertificateCheck +$resp = Invoke-WebRequest -Uri $MPE_Ajera_URI -Headers $Headers -Body $req_body -Method Post -SkipCertificateCheck