Reply

Get multiple page API result in powershell

Authority
Posts: 18
1426     0

Hi All

I was using the API before without any paging

 

Now i have added the paging like below

 

$url = "https://ddi.sgt.saint-gobain.net/wapi/v2.10.5/network?_paging=1&_return_as_object=1&_max_results=1000"

and i am getting next_page_id,  and getting the rest of the records.

I am doing these using postman now manually

 

But I need help how to do this using powershell

 

This is the code i am using currently

 

$url = "https://xx.xxx.xx.net/wapi/v2.10.5/network?_paging=1&_return_as_object=1&_max_results=1000"
$lapw = Get-Content "C:\pw.txt" | ConvertTo-SecureString -Key (Get-Content C:\aes.key)
$creds = New-Object System.Management.Automation.PsCredential("ACCOUNT",$lapw)
$Result = Invoke-RestMethod -Uri $url -Method Get -Credential $creds -Headers $headers -ContentType 'application/json'
Showing results for 
Search instead for 
Did you mean: 

Recommended for You

Businesses are investing heavily into securing company resources from cyber-attacks form cybercrimin