In the network tab of Chrome DevTools, I right click a request and select "Copy => Copy as PowerShell" and got the following scripts. The "Response" of the request is a json string.
$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$session.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36"
$session.Cookies.Add((New-Object System.Net.Cookie("INGRESSCOOKIE", "1661198715.885.38.892935", "/", "xx.com")))
$response = Invoke-WebRequest -UseBasicParsing -Uri "https://xx.com/api/v1/xxx?filter[reportDate]=2022-08-24&filter[forceReload]=true" `
-WebSession $session `
-Headers @{
"method"="GET"
"authority"="xx.com"
"scheme"="https"
"path"="/api/v1/sum? Filter[reportDate]=2022-08-24&filter[forceReload]=true"
"sec-ch-ua"="`"Chromium`";v=`"94`", `"Google Chrome`";v=`"94`", `";Not A Brand`";v=`"99`""
"accept"="application/vnd.api+json"
"authorization"="Bearer $($token. Token)"
"sec-ch-ua-mobile"="?0"
"sec-ch-ua-platform"="`"Windows`""
"origin"="https://xx.com"
"sec-fetch-site"="same-site"
"sec-fetch-mode"="cors"
"sec-fetch-dest"="empty"
"referrer"="https://xx.com/"
"accept-encoding"="gzip, deflate, br"
"accept-language"="en-US,en;q=0.9"
} `
-ContentType "application/vnd.api+json"
However, Write-Output $response.Content got a list integers instead of json string?
The $response.RawContent is
00 OK
Date: Fri, 26 Aug 2022 17:54:50 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Server: nginx/1.19.0
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: https://xx.com
Vary: Accept-Encoding
Vary: Origin
x-Server-Version: 0.1.133.0
x-Machine-Name: xx-service-6c65559c9f-ljsjf
x-Environment: UAT
api-supported-versions: 1
Strict-Transport-Security: max-age=15724800; includeSubDomains
Content-Type: application/vnd.api+json
Content-Encoding: br
???..?????OW.?M.?I???-2?2+.""?EdV?LOC???y???p????s.????.???)m?e.&RuCCC?????U?.?..
>.?.?%?a????x<?????DL7???????XO?iq??./?????}?i ??}????j.?i
??Z/?.?.???z?6._???????????x???M??|Z\-????]^??iq???q~?.?.????
....
How to decode the response content?