powershell search jira issues by jql via api

$headers = @{Authorization = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($env:JIRA_USERNAME + ":" + $env:JIRA_PASSWORD)) }

$query = @"
issuetype = Task
AND project in (AUTO, JS, RUA)
AND status in (Closed, Done)
AND created > 2019-01-01
AND created < 2019-12-31
AND updated > 2019-01-01
AND updated < 2019-12-31
"@

$startAt = 0
$issues = @()
do {
    $body = @{
        jql        = $query
        maxResults = 100
        startAt    = $startAt
        expand     = @("changelog")
        fields     = @("project", "updated", "status", "summary", "created")
    }

    $response = Invoke-RestMethod -Method Post "https://rabota.atlassian.net/rest/api/3/search" -ContentType "application/json" -Body ($body | ConvertTo-Json) -Headers $headers
    $issues += $Response.issues
    $startAt = $startAt + 100
    Write-Host "StartAt: $startAt, Total: $($response.total), Issues: $($issues.Count)"
} while ($startAt -lt $response.total)