Syntax
REST API endpoint to use in Add-ins:
<appweburl>/_api/SP.AppContextSite(@target)/web?$select=MasterUrl&@target=<hostweburl>
Embed Code Snippet
The following code snippet can be added to SharePoint page or in content editor web part as a script. This example is used to retrieve the default master page URL of a SharePoint site and this returns the site relative URL.
- <script type="text/javascript" src="/SiteAssets/Scripts/jquery.min.js"></script>
- <script type="text/javascript">
- $.ajax(
- {
- url: _spPageContextInfo.webAbsoluteUrl + "/_api/web?$select=masterurl", //THE ENDPOINT
- method: "GET",
- headers:
- {
- "Accept": "application/json; odata=verbose"
- },
- success: function(data)
- {
- //RESULTS HERE!!
- console.log('Default master page URL: ' + data.d.MasterUrl)
- alert('Default master URL: ' + data.d.MasterUrl);
- }
- });
- </script>

Ketak BhalsingPosted May 26, 2016, 2:09 AM
Nice Info...
Gowtham RajamanickamPosted May 25, 2016, 1:18 AM
Good one..
Debasis SahaPosted May 24, 2016, 3:00 PM
Nice Sharing..