I'm trying to make an REST API request using the filters parameters. My url is working fine in the browser, but in the JS request no.
https://xxxx.sharepoint.com/sites/myTestPage/_api/web/lists/getbytitle('ListDemo')/Items?$top=200&$select=State
Any of the parameters conditions works, anyone could you help me please.
Below is a powershell script that I'm using to test and make the same steps of JS file:
$url = "https://xxxx.sharepoint.com/sites/myTestPage/_api/web/lists/getbytitle('ListDemo')/Items?$top=200&$select=State"
$headers = @{}
$headers.Add("Authorization","Bearer " + $bearerCode)
$headers.Add("accept","application/json; odata=minimalmetadata")
#$headers.Add("content-type","application/json;odata=verbose")
$headers.Add("content-type","application/json;odata=minimalmetadata")
$headers.Add("Control-Allow-Origin","https://xxxx.sharepoint.com")
$headers.Add("Origin","https://xxxx.sharepoint.com")
$response = Invoke-WebRequest -Uri $url -Method GET -Header $headers
Write-host $response.RawContent