Public/ps1/Html/Start-LeftConnectJobHtml.ps1
function Start-LeftConnectJobHtml { param ($taskInformation) if (-not $taskInformation.url) { return @{ message= "No url found" sucess= $false } } $result =@{} if ($taskInformation.body) { if (-not $taskInformation.httpMethod) { $taskInformation.httpMethod = "POST" } if (-not $taskInformation.contentType) { $taskInformation.contentType = "application/json" } if (-not $taskInformation.headers) { $taskInformation.headers = "{""system"": ""no headers""}" } $result = Invoke-RestMethod -Body ($taskInformation.body) -Uri ($taskInformation.url) -Method ($taskInformation.httpMethod) -ContentType ($taskInformation.contentType) -Headers (convertfrom-json $taskInformation.headers -AsHashTable) $result.success = $true; } else { if (-not $taskInformation.httpMethod) { $taskInformation.httpMethod = "GET" } if (-not $taskInformation.headers) { $taskInformation.headers = "{""system"": ""no headers""}" } try { return @{ message= (Invoke-RestMethod -Uri ($taskInformation.url) -Method ($taskInformation.httpMethod) -Headers (convertfrom-json $taskInformation.headers -AsHashTable) ) sucess= $true } } catch { return @{ message= $_.Exception.Message messageCode = $_.Exception.Response.StatusCode.value__ sucess= $false response = $_.Exception.Response } } } } Start-LeftConnectJobHtml -taskInformation @{url = "https://www.google.com" body = "{}" contentType = "application/pdf" verb = "Merge"} |