Accessing SharePoint 2010 REST Interface using Windows PowerShell Version 3's Invoke-RestMethod cmdlet

Set the URL you intend to access:
$url = "http://sharepoint/_vti_bin/listdata.svc"
Now the URL used above may be at the root level or it may be at a site level, e.g.
$url = "http://sharepoint/_vti_bin/sites/it/listdata.svc"
If you want to access a specific list, you can use:
$url = "http://sharepoint/_vti_bin/sites/it/listdata.svc/ServiceRequests"
If you want to filter or order the data, you can use:
$url = "http://sharepoint/_vti_bin/sites/it/listdata.svc/ServiceRequest?$filter=ID eq '38'"
$url = "http://sharepoint/_vti_bin/sites/it/listdata.svc/ServiceRequest?$orderby=ID"

Once you have the URI set, you can use the Invoke-RestMethod cmdlet to get the required information back:
$ListService = Invoke-RestMethod -Uri $URL -UseDefaultCredentials

Popular posts from this blog

Get local computer UUID/GUID using Windows Powershell

gPLink and gPOptions

PSLoggedOn Getting Started on Windows Server 2008 R2