Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Get multiple page API result in powershell
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2021 06:58 AM
1476     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'
Labels: