Since SharePoint 2013 introduces a Representational State Transfer (REST) service that is comparable to the existing SharePoint client object models, it opens up a huge capabilities, in particular for administering and automating SharePoint Online when used with PowerShell.
My first idea was to utilize Invoke-RestMethod cmdlet, which was introduced in Windows PowerShell 3.0. Invoke-RestMethod cmdlet contains Credential parameter which could accept basic, digest, NTLM, and Kerberos authentication.
SharePoint Client Component SDK comes with a SharePointOnlineCredentials class which represents an object that provides credentials to access SharePoint Online resources. But unfortunately SharePoint Online credentials could not be passed in Invoke-RestMethod cmdlet, since claims based authentication is not supported by this cmdlet.
Below is demonstrated a simplified PowerShell script that to some extent mimics Invoke-RestMethod cmdlet. This script is intended for sending HTTPS request to a SharePoint Online REST service:
- Get started with the SharePoint 2013 REST service
- Use OData query operations in SharePoint REST requests
- InvokeRestMethod for the Rest of Us