So I have been trying to learn more about working with APIs and wanted to try and connect with the myGetpocket account app API. When I get the content back it seems to be in a Json format and each item received is a new
System.Management.Automation.PSCustomObject and each article is a NoteProperty.
TypeName: System.Management.Automation.PSCustomObject
Results of | Get Member
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
1000085475 NoteProperty System.Management.Automation.PSCustomObject 1000085475=@{item_id=1000085475; resolved_id=1000085...
$auturi = 'https://getpocket.com/v3/get'
$inv = Invoke-RestMethod -Method Post -Uri $auturi -Body $data
So if I run $inv.list in ISE it starts to populate with all of note Properties like 1000085475 and If I choose one then I get the information that I need.
Like so
item_id : 1000085475
resolved_id : 1000085475
given_url : https://gist.github.com/NickCraver/7ebf9efbfd0c3eab72e9
given_title :
favorite : 0
status : 0
time_added : 1445362357
time_updated : 1448913158
time_read : 0
time_favorited : 0
sort_id : 187
resolved_title : (In Progress) PowerShell Script I use to customize my machines in the same way for privacy, search, UI,
etc. · GitHub
resolved_url : https://gist.github.com/NickCraver/7ebf9efbfd0c3eab72e9#file-windows10-setup-ps1-L90
excerpt : Windows10-Setup.
is_article : 1
is_index : 0
has_video : 0
has_image : 0
word_count : 712
Any clue how I can iterate through all of the objects to create a new object and work with the data as needed ? I have been trying mutiple foreach-object methods and I can’t seem to figure it out.
I have also tried using Convertfrom-Json and Convertto-Json , Export-Clixml for a different way to work with the data.
Thanks for any help.