As you may already know, SharePoint 2013 offers RESTful Web Services that can be called through a browser to view the resultant data.
By default, the RESTful Web Service will return the resultant data as XML. However, for practical development purposes, the easiest way to work with it is when the data is instead returned as JSON.
But how do you get the web browser to display JSON data that you can view?
Well, fortunately, there is a Google Chrome extension that allows you to change the Request Headers sent to a SharePoint RESTful Web Service called ModHeader.
This can be added from the Google Chrome Store here: https://chrome.google.com/webstore/search/mod%20header?hl=en-US
Once the extension has been downloaded and installed, you can click on the ModHeader icon in the toolbar and add the following headers:
Accept application/json;odata=verbose
Content-Type application/json;odata=verbose
By default, the RESTful Web Service will return the resultant data as XML. However, for practical development purposes, the easiest way to work with it is when the data is instead returned as JSON.
But how do you get the web browser to display JSON data that you can view?
Well, fortunately, there is a Google Chrome extension that allows you to change the Request Headers sent to a SharePoint RESTful Web Service called ModHeader.
This can be added from the Google Chrome Store here: https://chrome.google.com/webstore/search/mod%20header?hl=en-US
Once the extension has been downloaded and installed, you can click on the ModHeader icon in the toolbar and add the following headers:
Accept application/json;odata=verbose
Content-Type application/json;odata=verbose
Now you can browse to the SharePoint RESTful Web Service, using a Url such as the following: http://myserver/sites/mysitecollection/_api/lists/getbytitle('MyList')/items
Once you browse to that site, you should now be able to view the resultant JSON data.
However, in order to properly parse and view the JSON data, you will want to use an online tool such as the following: http://json.parser.online.fr/
This will allow you to easily view the structure of the JSON data so that you can write appropriate queries in any SharePoint applications you are developing.
No comments:
Post a Comment