Here’s a set of sample REST calls that work for me and may help you out as well. As of 02/2014, there are two examples 🙂
- Reference a Column With Spaces In Its Name
- Reference a Multi-Select Column
- Perform a People Search via REST
I’ll add to this as time passes.
Here are some useful inks I’ve found as well:
Reference a Column With Spaces In Its Name
I create a custom list with a column named “Blog Author” (space between Blog and Author).
The $select to reference that column is:
Simply replace the space with “_x0020_”. We see the _x0020_ in many examples across the internets and REST is no different.
If you don’t do that, you’re liable to get an error message like this:
The expression “Blog Author” is not valid.
Reference a Multi-Select Lookup Column
- Create a custom list named Categories.
- Add some categories. I added categories thusly:
- Create another custom list called MockBlog and add Categories as a multi-select list column (or site column if that’s how you roll).
Add some items to your Mockblog list and you’re ready.
An Ajax style call using jQuery will look something like this:
serverUrl += "/_api/web/lists/GetByTitle('MockBlog')/items" + "?$select=Title,Categories/Title,Blog_x0020_Author/Title" + "&$expand=Blog_x0020_Author,Categories";
We’re telling SharePoint “Give me the title for all the Categories (Categories/Title). Get the actual values for Title by $expanding the Categories list.” (My RESTful paraphrasing is probably pretty loose, but this how I’m interpreting it).
(The above is a JSON object)
Perform a People Search via REST
I blogged about this separately. The key is to specify a sourceid parameter whose value is the GUID of the Local People content source. (Content sources used to be called scopes and it’s my-oh-my so hard not to call everything a scope for me!).
Read more about it here: http://www.mstechblogs.com/paul/?p=10385
Follow me on Twitter at http://www.twitter.com/pagalvin