SharePoint on-line 2013 web service call to execute a CAML query against a list

Well, talk about a journey; If you will be doing any SharePoint on-line 2013 workflows, you are going to need to understand this.

These were my inspiration
Great tutorial
Great Fiddler reference

Without those two, I would still be there at Christmas.  This is my summary;

I am querying a list in a sub web called ‘Config’ for a list Called ConfigItems

First you need to grab the auth cookies, browse to https://yourSPonline.sharepoint.com

FIDDLER: Get ContextInfo to grab a form digest from: This is a GET
https://yourSPonline.sharepoint.com/_api/contextinfo”

User-Agent: Fiddler
Cookie: rtFa+sO9PIAAAAA==; FedAuth=77u/PD94bWwg==
Content-Type: application/json;odata=verbose;
Content-Length: 0
Accept: application/json;odata=verbose;
Host: yourSPonline.sharepoint.com

Now, examine the json, find formdigest
Add it to your headers as X-RequestDigest
X-RequestDigest: 0x445623A1758C83A5,25 Mar 2014 07:37:55 -0000
So now you have

User-Agent: Fiddler
Cookie: rtFa+sO9PIAAAAA==; FedAuth=77u/PD94bWwg==
Content-Type: application/json;odata=verbose;
Content-Length: 0
Accept: application/json;odata=verbose;
Host: dev3.sharepoint.com
X-RequestDigest: 0x445623A1758C83A5,25 Mar 2014 07:37:55 -0000

Now you can call list api’s – Get all items from a sub web called Config USE A GET

https://yourSPonline.sharepoint.com/Config/_api/web/lists/getByTitle(‘configitems’)/items”

or via CAML, this is a PUT

https://yourSPonline.sharepoint.com/Config/_api/web/lists/getByTitle(‘configitems’)/GetItems(query=@v1)?@v1={“ViewXml”:”<View><Query><ViewFields><FieldRef%20Name=’Title’/><FieldRef%20Name=’ItemValue’/></ViewFields><Where><Eq><FieldRef%20Name=’ItemGroup’/><Value%20Type=’Choice’>SomeWorkflow</Value></Eq></Where></Query></View>”}
or
https://yourSPonline.sharepoint.com/Config/_api/web/lists/getByTitle(‘configitems’)/GetItems(query=@v1)?@v1={“ViewXml”:”<View><Query><ViewFields><FieldRef%20Name=’Title’/><FieldRef%20Name=’ItemValue’/></ViewFields><Where><Eq><FieldRef%20Name=’ItemGroup’/><Value%20Type=’Choice’>None</Value></Eq></Where></Query></View>”}