Webs REST API reference
Learn about site-related resources and endpoints in the SharePoint REST API.
Applies to: apps for SharePoint | SharePoint Online | SharePoint Server 2013
About the request examples in this article
The examples in this article use jQuery AJAX requests. Before you try to use the examples, do the following:
Change <site url> and other placeholder data such as any IDs, names, or paths of SharePoint entities.
If you’re using the cross-domain library, you'll have to change the request format. For example, it might look like the following.
executor.executeAsync({ url: "<app web url>/_api/SP.AppContextSite(@target)/web/getchanges?@target='<host web url>'", method: "POST", body: "{ 'query': { '__metadata': { 'type': 'SP.ChangeQuery' }, 'Web': true, 'Update': true } }", headers: { "accept": "application/json;odata=verbose", "content-type": "application/json;odata=verbose" }, success: successHandler, error: errorHandler });
If you’re using OAuth, add an Authorization header ("Authorization": "Bearer " + <access token>) to send the OAuth access token.
Remove the line breaks from the url and data property values in the request examples. Line breaks are added to the examples to make them easier to read.
If you want the server to return responses in Atom format, remove the "accept": "application/json;odata=verbose" header.
See How REST requests differ by environment for more information about changing the requests. See Additional resources for links to more information about using the cross-domain library, OAuth, and the SharePoint REST service.
Tip
The SharePoint Online REST service supports combining multiple requests into a single call to the service by using the OData $batch query option. For details and links to code samples, see Make batch requests with the REST APIs. This option is not yet supported for on-premise SharePoint.
Web resource
Endpoint URI | Properties | Methods | OData representation
Represents a SharePoint site. A site is a type of SP.SecurableObject.
Endpoint URI
http://<site url>/_api/web
Supported HTTP methods
GET | POST | DELETE | MERGE | PUT
Request examples
GET request example: Get a site
$.ajax({
url: "http://<site url>/_api/web",
type: "GET",
headers: { "accept": "application/json;odata=verbose" },
success: successHandler,
error: errorHandler
});
POST request example: Create a site by using the Add method from the WebCollection resource
$.ajax({
url: "http://<site url>/_api/web/webs/add",
type: "POST",
data: "{ 'parameters': { '__metadata': { 'type': 'SP.WebCreationInformation' },
'Title': 'Team projects', 'Url': 'TeamProjects', 'WebTemplate': 'STS',
'UseSamePermissionsAsParentSite': true } }",
headers: {
"X-RequestDigest": <form digest value>,
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"content-length": <length of body data>
},
success: successHandler,
error: errorHandler
});
Or you can use the Add method from the WebInformationCollection resource, as shown in Creating a site with REST.
MERGE request example: Change a site
$.ajax({
url: "http://<site url>/_api/web",
type: "POST",
data: "{ '__metadata': { 'type': 'SP.Web' }, 'Description': 'All team projects',
'EnableMinimalDownload': false }",
headers: {
"X-RequestDigest": <form digest value>,
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"content-length": <length of body data>,
"X-HTTP-Method": "MERGE"
},
success: successHandler,
error: errorHandler
});
DELETE request example: Delete a site
$.ajax({
url: "http://<site url>/_api/web",
type: "POST",
headers: {
"X-RequestDigest": <form digest value>,
"X-HTTP-Method": "DELETE"
},
success: successHandler,
error: errorHandler
});
Web properties
To get a property, send a GET request to the property endpoint, as shown in the following example.
$.ajax({
url: "http://<site url>/_api/web/<property name>",
type: "GET",
headers: { "accept": "application/json;odata=verbose" },
success: successHandler,
error: errorHandler
});
Property |
Type |
R/W |
Description |
|
---|---|---|---|---|
AllowCreateDeclarativeWorkflowForCurrentUser |
Boolean |
R |
No |
Specifies whether the current user can create declarative workflows. If not disabled on the Web application, the value is the same as the AllowCreateDeclarativeWorkflow property of the site collection. Default value: true. |
AllowDesignerForCurrentUser |
Boolean |
R |
No |
Gets a value that specifies whether the current user is allowed to use a designer application to customize this site. |
AllowMasterPageEditingForCurrentUser |
Boolean |
R |
No |
Gets a value that specifies whether the current user is allowed to edit the master page. |
AllowRevertFromTemplateForCurrentUser |
Boolean |
R |
No |
Gets a value that specifies whether the current user is allowed to revert the site to a default site template. |
AllowRssFeeds |
Boolean |
R |
Yes |
Gets a value that specifies whether the site allows RSS feeds. |
AllowSaveDeclarativeWorkflowAsTemplateForCurrentUser |
Boolean |
R |
No |
Specifies whether the current user can save declarative workflows as a template. If not disabled on the Web application, the value is the same as the AllowSaveDeclarativeWorkflowAsTemplate property of the site collection. Default value: true. |
AllowSavePublishDeclarativeWorkflowForCurrentUser |
Boolean |
RW |
No |
Specifies whether the current user can save or publish declarative workflows. If not disabled on the Web application, the value is the same as the AllowSavePublishDeclarativeWorkflowAsTemplate property of the site collection. When enabled, can only be set by a site collection administrator. Default value: true. |
AllProperties |
SP.PropertyValues |
R |
No |
Gets a collection of metadata for the Web site. |
AppInstanceId |
GUID |
R |
Yes |
The instance Id of the App Instance that this web represents. |
AssociatedMemberGroup |
RW |
No |
Gets or sets the group of users who have been given contribute permissions to the Web site. |
|
AssociatedOwnerGroup |
RW |
No |
Gets or sets the associated owner group of the Web site. |
|
AssociatedVisitorGroup |
RW |
No |
Gets or sets the associated visitor group of the Web site. |
|
AvailableContentTypes |
SP.ContentTypeCollection |
R |
No |
Gets the collection of all content types that apply to the current scope, including those of the current Web site, as well as any parent Web sites. |
AvailableFields |
R |
No |
Gets a value that specifies the collection of all fields available for the current scope, including those of the current site, as well as any parent sites. |
|
Configuration |
Int16 |
R |
Yes |
Gets either the identifier (ID) of the site definition configuration that was used to create the site, or the ID of the site definition configuration from which the site template used to create the site was derived. |
ContentTypes |
SP.ContentTypeCollection |
R |
No |
Gets the collection of content types for the Web site. |
Created |
DateTime |
R |
Yes |
Gets a value that specifies when the site was created. |
CurrentUser |
R |
No |
Gets the current user of the site. |
|
CustomMasterUrl |
String |
RW |
Yes |
Gets or sets the URL for a custom master page file to apply to the website. |
Description |
String |
RW |
Yes |
Gets or sets the description for the site. |
DesignerDownloadUrlForCurrentUser |
String |
R |
No |
Gets the URL where the current user can download SharePoint Designer. |
DocumentLibraryCalloutOfficeWebAppPreviewersDisabled |
Boolean |
R |
Yes |
Determines if the Document Library Callout's WAC previewers are enabled or not. |
EffectiveBasePermissions |
R |
No |
Represents the intersection of permissions of the app principal and the user principal. In the app-only case, this property returns only the permissions of the app principal. To check only user permissions (ignoring app permissions), use the GetUserEffectivePermissions method. |
|
EnableMinimalDownload |
Boolean |
RW |
Yes |
Gets or sets a Boolean value that specifies whether the Web site should use Minimal Download Strategy. |
EventReceivers |
SP.EventReceiverCollection |
R |
No |
Gets the collection of event receiver definitions that are currently available on the website. |
Features |
SP.FeatureCollection |
R |
No |
Gets a value that specifies the collection of features that are currently activated in the site. |
Fields |
R |
No |
Gets the collection of field objects that represents all the fields in the Web site. |
|
Folders |
R |
No |
Gets the collection of all first-level folders in the Web site. |
|
Id |
GUID |
R |
Yes |
Gets a value that specifies the site identifier for the site. |
Language |
Int32 |
R |
Yes |
Gets a value that specifies the LCID for the language that is used on the site. |
LastItemModifiedDate |
DateTime |
R |
Yes |
Gets a value that specifies when an item was last modified in the site. |
Lists |
R |
No |
Gets the collection of all lists that are contained in the Web site available to the current user based on the permissions of the current user. |
|
ListTemplates |
SP.ListTemplateCollection |
R |
No |
Gets a value that specifies the collection of list definitions and list templates available for creating lists on the site. |
MasterUrl |
String |
RW |
Yes |
Gets or sets the URL of the master page that is used for the website. |
Navigation |
SP.Navigation |
R |
No |
Gets a value that specifies the navigation structure on the site, including the Quick Launch area and the top navigation bar. |
ParentWeb |
R |
No |
Gets the parent website of the specified website. |
|
PushNotificationSubscribers |
SP.PushNotificationSubscriberCollection |
R |
No |
Gets the collection of push notification subscribers over the site. |
QuickLaunchEnabled |
Boolean |
RW |
Yes |
Gets or sets a value that specifies whether the Quick Launch area is enabled on the site. |
RecycleBin |
SP.RecycleBin |
R |
No |
Specifies the collection of recycle bin items of the recycle bin of the site. |
RecycleBinEnabled |
Boolean |
R |
Yes |
Gets or sets a value that determines whether the recycle bin is enabled for the website. |
RegionalSettings |
SP.RegionalSettings |
R |
No |
Gets the regional settings that are currently implemented on the website. |
RoleDefinitions |
R |
No |
Gets the collection of role definitions for the Web site. |
|
RootFolder |
R |
No |
Gets the root folder for the Web site. |
|
SaveSiteAsTemplateEnabled |
Boolean |
RW |
No |
Gets or sets a Boolean value that specifies whether the Web site can be saved as a site template. |
ServerRelativeUrl |
String |
RW |
Yes |
Gets or sets the server-relative URL for the Web site. |
ShowUrlStructureForCurrentUser |
Boolean |
R |
No |
Gets a value that specifies whether the current user is able to view the file system structure of this site. |
SiteGroups |
R |
No |
Gets the collection of groups for the site collection. |
|
SiteUserInfoList |
R |
No |
Gets the UserInfo list of the site collection that contains the Web site. |
|
SiteUsers |
R |
No |
Gets the collection of all users that belong to the site collection. |
|
SupportedUILanguageIds |
Collection(Int32) |
R |
No |
Specifies the language code identifiers (LCIDs) of the languages that are enabled for the site. |
SyndicationEnabled |
Boolean |
RW |
Yes |
Gets or sets a value that specifies whether the RSS feeds are enabled on the site. |
ThemeInfo |
SP.ThemeInfo |
R |
No |
The theming information for this site. This includes information like colors, fonts, border radii sizes etc. |
Title |
String |
RW |
Yes |
Gets or sets the title for the Web site. |
TreeViewEnabled |
Boolean |
RW |
Yes |
Gets or sets value that specifies whether the tree view is enabled on the site. |
UIVersion |
Int32 |
RW |
Yes |
Gets or sets the user interface (UI) version of the Web site. |
UIVersionConfigurationEnabled |
Boolean |
RW |
Yes |
Gets or sets a value that specifies whether the settings UI for visual upgrade is shown or hidden. |
Url |
String |
R |
Yes |
Gets the absolute URL for the website. |
UserCustomActions |
R |
No |
Gets a value that specifies the collection of user custom actions for the site. |
|
WebInfos |
SP.WebInformation |
R |
No |
Represents key properties of the subsites of a site. |
Webs |
R |
No |
Gets a Web site collection object that represents all Web sites immediately beneath the Web site, excluding children of those Web sites. |
|
WebTemplate |
String |
R |
Yes |
Gets the name of the site definition or site template that was used to create the site. |
WorkflowAssociations |
SP.WorkflowAssociationCollection |
R |
No |
Gets a value that specifies the collection of all workflow associations for the site. |
WorkflowTemplates |
SP.WorkflowTemplateCollection |
R |
No |
Gets a value that specifies the collection of workflow templates associated with the site. |
Web methods
ApplyTheme
ApplyWebTemplate
BreakRoleInheritance
DeleteObject
DoesPushNotificationSubscriberExist
DoesUserHavePermissions
EnsureUser
ExecuteRemoteLOB
GetAppBdcCatalog
GetAppBdcCatalogForAppInstance
GetAppInstanceById
GetAppInstancesByProductId
GetAvailableWebTemplates
GetCatalog
GetChanges
GetContextWebInformation
GetEntity
GetDocumentLibraries
GetFileByServerRelativeUrl
GetFolderByServerRelativeUrl
GetList
GetPushNotificationSubscriber
GetPushNotificationSubscribersByArgs
GetPushNotificationSubscribersByUser
GetSubwebsFilteredForCurrentUser
GetUserById
GetUserEffectivePermissions
GetWebUrlFromPageUrl
LoadAndInstallApp
LoadAndInstallAppInSpecifiedLocale
LoadApp
MapsToIcon
ProcessExternalNotification
RegisterPushNotificationSubscriber
ResetRoleInheritance
UnregisterPushNotificationSubscriber
ApplyTheme method
Applies the theme specified by the contents of each of the files specified in the arguments to the site.
Endpoint |
/applytheme(colorpaletteurl, fontschemeurl, backgroundimageurl, sharegenerated) |
Parameters |
|
HTTP method |
POST |
Response |
None |
Request example
$.ajax({
url: "http://<site url>/_api/web
/applytheme(colorpaletteurl='/_catalogs/theme/15/palette011.spcolor',
fontschemeurl='/_catalogs/theme/15/fontscheme007.spfont',
backgroundimageurl='/piclibrary/th.jpg', sharegenerated=true)",
type: "POST",
headers: { "X-RequestDigest": <form digest value> },
success: successHandler,
error: errorHandler
});
Or, you can send the parameters in the body: { 'colorPaletteUrl':'/_catalogs/theme/15/palette011.spcolor', 'fontSchemeUrl':'/_catalogs/theme/15/fontscheme007.spfont', 'backgroundImageUrl':'/piclibrary/pics/th.jpg', 'shareGenerated':true }
See Themes overview for SharePoint 2013.
ApplyWebTemplate method
Applies the specified site definition or site template to the Web site that has no template applied to it.
Note
Calling this method inside a site provisioning callback function defined within the same site definition configuration that is being applied can result in an infinite loop. Instead, create two similar site-definition configurations within the site definition, one that is visible and one that is hidden. The visible configuration can then contain a provisioning assembly callback that applies the hidden configuration to sites.
Endpoint |
/applywebtemplate('<site definition or web template name>') |
Parameters |
Type: String |
HTTP method |
POST |
Response |
None |
Request example
$.ajax({
url: "http://<site url>/_api/web
/applywebtemplate(@v)?@v='blog%230'",
type: "POST",
headers: { "X-RequestDigest": <form digest value> },
success: successHandler,
error: errorHandler
});
BreakRoleInheritance method
Creates unique role assignments for the securable object.
Endpoint |
/breakroleinheritance(copyroleassignments, clearsubscopes) |
Parameters |
|
HTTP method |
POST |
Response |
None |
Request example
$.ajax({
url: "http://<site url>/_api/web
/breakroleinheritance(copyroleassignments=false, clearsubscopes=true)",
method: "POST",
headers: { "X-RequestDigest": <form digest value> },
success: successHandler,
error: errorHandler
});
DeleteObject method
The recommended way to delete a site is to send a DELETE request to the Web resource endpoint, as shown in Web request examples.
DoesPushNotificationSubscriberExist method
Checks whether the push notification subscriber exist for the current user with the given device application instance ID.
Endpoint |
/doespushnotificationsubscriberexist('<device app instance id >') |
Parameters |
Type: GUID |
HTTP method |
GET |
Response |
Type: Boolean |
DoesUserHavePermissions method
Returns whether the current user has the given set of permissions.
Endpoint |
/doesuserhavepermissions(@v)?@v={'High':'<value>', 'Low':'<value>'} |
Parameters |
Type: SP.BasePermissions |
HTTP method |
GET |
Response |
Type: Boolean |
Request example
$.ajax({
url: "http://<site url>/_api/web
/doesuserhavepermissions(@v)?@v={'High':'432', 'Low':'1012866047'}",
type: "GET",
headers: { "accept": "application/json;odata=verbose" },
success: successHandler,
error: errorHandler
});
EnsureUser method
Checks whether the specified login name belongs to a valid user in the site. If the user doesn't exist, adds the user to the site.
Endpoint |
/ensureuser |
Parameters |
|
HTTP method |
POST |
Response |
Type: SP.User |
Request example
$.ajax({
url: "http://<site url>/_api/web
/ensureuser",
type: "POST",
data: "{ 'logonName': 'i:0#.f|membership|user@domain.onmicrosoft.com' }",
headers: {
"X-RequestDigest": <form digest value>,
"accept": "application/json;odata=verbose"
},
success: successHandler,
error: errorHandler
});
ExecuteRemoteLOB method
Sends data to an OData service.
This method is the entry point for hybrid connectivity and is used to invoke the OData service from an on-premises server. Input parameters required to make the OData service call are passed as custom HTTP headers. See ExecuteRemoteLOB.
Endpoint |
/executeremotelob |
Parameters |
|
HTTP method |
POST |
Response |
Type: Stream |
GetAppBdcCatalog method
Endpoint |
/getappbdccatalog |
Parameters |
None |
HTTP method |
POST |
Response |
Type: SP.BusinessData.AppBdcCatalog |
GetAppBdcCatalogForAppInstance method
Endpoint |
/getappbdccatalogforappinstance('<app instance id>') |
Parameters |
Type: GUID |
HTTP method |
POST |
Response |
Type: SP.BusinessData.AppBdcCatalog |
GetAppInstanceById method
Retrieves an AppInstance installed on this Site.
Endpoint |
/getappinstancebyid('<app instance id>') |
Parameters |
Type: GUID |
HTTP method |
GET |
Response |
Type: SP.AppInstance |
Request example
$.ajax({
url: "http://<site url>/_api/web
/getappinstancebyid('3122ea58-8435-4d9a-a302-345599838671')",
type: "GET",
headers: { "accept": "application/json;odata=verbose" },
success: successHandler,
error: errorHandler
});
GetAppInstancesByProductId method
Retrieves all AppInstances installed on this site that are instances of the specified App.
Endpoint |
/getappinstancesbyproductid('<product id>') |
Parameters |
Type: GUID |
HTTP method |
GET |
Response |
Type: Collection(SP.AppInstance) |
GetAvailableWebTemplates method
Returns a collection of site templates available for the site.
Endpoint |
/getavailablewebtemplates(lcid, doincludecrosslanguage) |
Parameters |
|
HTTP method |
GET |
Response |
Type: SP.WebTemplateCollection |
Request example
$.ajax({
url: "http://<site url>/_api/web
/getavailablewebtemplates(lcid=1033, doincludecrosslanguage=true)",
type: "GET",
headers: { "accept": "application/json;odata=verbose" },
success: successHandler,
error: errorHandler
});
GetCatalog method
Returns the list gallery on the site.
Endpoint |
/getcatalog(<gallery type >) |
Parameters |
Type: Int32 |
HTTP method |
GET |
Response |
Type: SP.List |
Request example
$.ajax({
url: "http://<site url>/_api/web
/getcatalog(113)",
type: "GET",
headers: { "accept": "application/json;odata=verbose" },
success: successHandler,
error: errorHandler
});
GetChanges method
Returns the collection of all changes from the change log that have occurred within the scope of the site, based on the specified query.
Endpoint |
/getchanges |
Parameters |
|
HTTP method |
POST |
Response |
Type: SP.ChangeCollection |
Request example
$.ajax({
url: "http://<site url>/_api/web
/getchanges",
type: "POST",
data: "{ 'query': { '__metadata': { 'type': 'SP.ChangeQuery' },
'Web': true, 'Update': true, 'Add': true } }",
headers: {
"X-RequestDigest": <form digest value>
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"content-length": <length of body data>
},
success: successHandler,
error: errorHandler
});
GetContextWebInformation
Gets the context information for the site. Static method.
Endpoint |
http://<site url>/_api/contextinfo |
Parameters |
None |
HTTP method |
POST |
Response |
Type: SP.ContextWebInformation |
Request example
$.ajax({
url: "http://<site url>/_api
/contextinfo",
type: "POST",
headers: {
"X-RequestDigest": <form digest value>,
"accept": "application/json;odata=verbose"
},
success: successHandler,
error: errorHandler
});
GetCustomListTemplates method
Gets the custom list templates for the site.
Endpoint |
/getcustomlisttemplates |
Parameters |
None |
HTTP method |
GET |
Response |
Type: SP.ListTemplateCollection |
Request example
$.ajax({
url: "http://<site url>/_api/web
/getcustomlisttemplates",
type: "GET",
headers: { "accept": "application/json;odata=verbose" },
success: successHandler,
error: errorHandler
});
GetDocumentLibraries method
Gets the document libraries on a site. Static method. (SharePoint Online only)
Endpoint |
http://<site url>/_api/sp.web.getdocumentlibraries(@v)?@v='<full site url>' |
Parameters |
Type: String |
HTTP method |
GET |
Response |
Type: Collection(SP.DocumentLibraryInformation) |
Request example
$.ajax({
url: "http://<site url>/_api
/sp.web.getdocumentlibraries(@v)?@v='https://contoso.sharepoint.com'",
method: "GET",
headers: { "accept": "application/json;odata=verbose" },
success: successHandler,
error: errorHandler});
GetEntity method
Gets the specified external content type in a line-of-business (LOB) system application.
Endpoint |
/getentity(namespace, name) |
Parameters |
|
HTTP method |
POST |
Response |
Type: SP.BusinessData.Entity |
GetFileByServerRelativeUrl method
Returns the file object located at the specified server-relative URL.
Endpoint |
/getfilebyserverrelativeurl('<server relative url>') |
Parameters |
Type: String |
HTTP method |
GET |
Response |
Type: SP.File |
Request example
$.ajax({
url: "http://<site url>/_api/web
/getfilebyserverrelativeurl('/templates/ResourceRequest.docx')",
type: "GET",
headers: { "accept": "application/json;odata=verbose" },
success: successHandler,
error: errorHandler
});
GetFolderByServerRelativeUrl method
Returns the folder object located at the specified server-relative URL.
Endpoint |
/getfolderbyserverrelativeurl('<server relative url>') |
Parameters |
Type: String |
HTTP method |
GET |
Response |
Type: SP.Folder |
Request example
$.ajax({
url: "http://<site url>/_api/web
/getfolderbyserverrelativeurl('/templates/test')",
type: "GET",
headers: { "accept": "application/json;odata=verbose" },
success: successHandler,
error: errorHandler
});
GetList method
Gets the list at the specified site-relative URL.
Endpoint |
/getlist('<list url>') |
Parameters |
Type: String |
HTTP method |
GET |
Response |
Type: SP.List |
Request example
$.ajax({
url: "http://<site url>/_api/web
/getlist('/lists/ideas')",
type: "GET",
headers: { "accept": "application/json;odata=verbose" },
success: successHandler,
error: errorHandler
});
GetPushNotificationSubscriber method
Gets the push notification subscriber over the site for the specified device application instance ID.
Endpoint |
/getpushnotificationsubscriber('<device app instance id>') |
Parameters |
Type: GUID |
HTTP method |
GET |
Response |
Type: SP.PushNotificationSubscriber |
GetPushNotificationSubscribersByArgs method
Queries for the push notification subscribers over the site for the specified value of custom arguments. Null or empty custom arguments will return subscribers without any filtering.
Endpoint |
/getpushnotificationsubscribersbyargs('<arguments>') |
Parameters |
Type: String |
HTTP method |
GET |
Response |
Type: SP.PushNotificationSubscriberCollection |
GetPushNotificationSubscribersByUser method
Queries for the push notification subscribers over the site for the specified user.
Endpoint |
/getpushnotificationsubscribersbyuser(@v)?@v='<login name>' |
Parameters |
Type: String |
HTTP method |
GET |
Response |
Type: SP.PushNotificationSubscriberCollection |
GetSubwebsFilteredForCurrentUser method
Returns the collection of child sites of the current site based on the specified query.
Available in SharePoint Online only.
Endpoint |
/getsubwebsfilteredforcurrentuser(nwebtemplatefilter, nconfigurationfilter) |
Parameters |
|
HTTP method |
GET |
Response |
Type: Collection(SP.WebInformation) |
Request example
$.ajax({
url: "http://<site url>/_api/web
/getsubwebsfilteredforcurrentuser(nwebtemplatefilter=-1,nconfigurationfilter=0)",
type: "GET",
headers: { "accept": "application/json;odata=verbose" },
success: successHandler,
error: errorHandler
});
GetUserById method
Returns the user corresponding to the specified member identifier for the current site.
Endpoint |
/getuserbyid(<user id>) |
Parameters |
Type: Int32 |
HTTP method |
GET |
Response |
Type: SP.User |
Request example
$.ajax({
url: "http://<site url>/_api/web
/getuserbyid(12)",
type: "GET",
headers: { "accept": "application/json;odata=verbose" },
success: successHandler,
error: errorHandler
});
GetUserEffectivePermissions method
Gets the effective permissions that the specified user has within the current application scope.
To check the permissions of a user other than the current user, apps must have Full Control permissions for the site.
Endpoint |
/getusereffectivepermissions(@v)?@v='<login name>' |
Parameters |
Type: String |
HTTP method |
GET |
Response |
Type: SP.BasePermissions |
Request example
$.ajax({
url: "http://<site url>/_api/web
/getusereffectivepermissions(@v)?@v='i%3A0%23.f%7Cmembership%7Cuser%40domain.onmicrosoft.com'",
type: "GET",
headers: { "accept": "application/json;odata=verbose" },
success: successHandler,
error: errorHandler
});
GetWebUrlFromPageUrl method
Gets the site URL from a page URL. Static method.
Endpoint |
http://<site url>/_api/sp.web.getweburlfrompageurl(@v)?@v='<full page url>' |
Parameters |
Type: String |
HTTP method |
GET |
Response |
Type: String |
Request example
$.ajax({
url: "http://<site url>/_api
/sp.web.getweburlfrompageurl(@v)?@v='https://contoso.sharepoint.com/subsite/_layouts/15/start.aspx'",
method: "GET",
headers: { "accept": "application/json;odata=verbose" },
success: successHandler,
error: errorHandler
});
LoadAndInstallApp method
Uploads and installs an app package to this site.
This site must be enabled for remote development.
Endpoint |
/loadandinstallapp |
Parameters |
|
HTTP method |
POST |
Response |
Type: SP.AppInstance |
LoadAndInstallAppInSpecifiedLocale method
Uploads and installs an App package on the site in a specified locale.
Endpoint |
/loadandinstallappinspecifiedlocale |
Parameters |
|
HTTP method |
POST |
Response |
Type: SP.AppInstance |
LoadApp method
Uploads an App package and creates an instance from it.
Endpoint |
/loadapp |
Parameters |
|
HTTP method |
POST |
Response |
Type: SP.AppInstance |
MapToIcon method
Returns the name of the image file for the icon that is used to represent the specified file.
Endpoint |
/maptoicon(filename, progid, size) |
Parameters |
|
HTTP method |
GET |
Response |
Type: String |
Request example
$.ajax({
url: "http://<site url>/_api/web
/maptoicon(filename='spectemplate.docx', progid='', size=0)",
type: "GET",
headers: { "accept": "application/json;odata=verbose" },
success: successHandler,
error: errorHandler
});
ProcessExternalNotification method
Processes a notification from an external system.
Endpoint |
/processexternalnotification |
Parameters |
|
HTTP method |
POST |
Response |
Type: String |
RegisterPushNotificationSubscriber method
Registers the subscriber for push notifications over the site. If the registration already exists, the service token is updated with the new value.
Endpoint |
/registerpushnotificationsubscriber(deviceappinstanceid, servicetoken) |
Parameters |
|
HTTP method |
POST |
Response |
Type: SP.PushNotificationSubscriber |
ResetRoleInheritance method
Resets the role inheritance for the securable object and inherits role assignments from the parent securable object.
Endpoint |
/resetroleinheritance |
Parameters |
None |
HTTP method |
POST |
Response |
None |
Request example
$.ajax({
url: "http://<site url>/_api/web
/resetroleinheritance",
method: "POST",
headers: { "X-RequestDigest": <form digest value> },
success: successHandler,
error: errorHandler
});
UnregisterPushNotificationSubscriber method
Unregisters the subscriber for push notifications from the site.
Endpoint |
/unregisterpushnotificationsubscriber('<device app instance id>') |
Parameters |
Type: GUID |
HTTP method |
POST |
Response |
None |
OData representation
The following example represents a Web resource in JSON format.
{"d":{
"__metadata":{
"id":"https://<site url>/_api/Web",
"uri":"https://<site url>/_api/Web",
"type":"SP.Web"
},
"FirstUniqueAncestorSecurableObject":{"__deferred":{"uri":"https://<site url>/_api/Web/FirstUniqueAncestorSecurableObject"}},
"RoleAssignments":{"__deferred":{"uri":"https://<site url>/_api/Web/RoleAssignments"}},
"AllProperties":{"__deferred":{"uri":"https://<site url>/_api/Web/AllProperties"}},
"AssociatedMemberGroup":{"__deferred":{"uri":"https://<site url>/_api/Web/AssociatedMemberGroup"}},
"AssociatedOwnerGroup":{"__deferred":{"uri":"https://<site url>/_api/Web/AssociatedOwnerGroup"}},
"AssociatedVisitorGroup":{"__deferred":{"uri":"https://<site url>/_api/Web/AssociatedVisitorGroup"}},
"AvailableContentTypes":{"__deferred":{"uri":"https://<site url>/_api/Web/AvailableContentTypes"}},
"AvailableFields":{"__deferred":{"uri":"https://<site url>/_api/Web/AvailableFields"}},
"ContentTypes":{"__deferred":{"uri":"https://<site url>/_api/Web/ContentTypes"}},
"CurrentUser":{"__deferred":{"uri":"https://<site url>/_api/Web/CurrentUser"}},
"DescriptionResource":{"__deferred":{"uri":"https://<site url>/_api/Web/DescriptionResource"}},
"EventReceivers":{"__deferred":{"uri":"https://<site url>/_api/Web/EventReceivers"}},
"Features":{"__deferred":{"uri":"https://<site url>/_api/Web/Features"}},
"Fields":{"__deferred":{"uri":"https://<site url>/_api/Web/Fields"}},
"Folders":{"__deferred":{"uri":"https://<site url>/_api/Web/Folders"}},
"Lists":{"__deferred":{"uri":"https://<site url>/_api/Web/Lists"}},
"ListTemplates":{"__deferred":{"uri":"https://<site url>/_api/Web/ListTemplates"}},
"Navigation":{"__deferred":{"uri":"https://<site url>/_api/Web/Navigation"}},
"ParentWeb":{"__deferred":{"uri":"https://<site url>/_api/Web/ParentWeb"}},
"PushNotificationSubscribers":{"__deferred":{"uri":"https://<site url>/_api/Web/PushNotificationSubscribers"}},
"RecycleBin":{"__deferred":{"uri":"https://<site url>/_api/Web/RecycleBin"}},
"RegionalSettings":{"__deferred":{"uri":"https://<site url>/_api/Web/RegionalSettings"}},
"RoleDefinitions":{"__deferred":{"uri":"https://<site url>/_api/Web/RoleDefinitions"}},
"RootFolder":{"__deferred":{"uri":"https://<site url>/_api/Web/RootFolder"}},
"SiteGroups":{"__deferred":{"uri":"https://<site url>/_api/Web/SiteGroups"}},
"SiteUserInfoList":{"__deferred":{"uri":"https://<site url>/_api/Web/SiteUserInfoList"}},
"SiteUsers":{"__deferred":{"uri":"https://<site url>/_api/Web/SiteUsers"}},
"ThemeInfo":{"__deferred":{"uri":"https://<site url>/_api/Web/ThemeInfo"}},
"TitleResource":{"__deferred":{"uri":"https://<site url>/_api/Web/TitleResource"}},
"UserCustomActions":{"__deferred":{"uri":"https://<site url>/_api/Web/UserCustomActions"}},
"Webs":{"__deferred":{"uri":"https://<site url>/_api/Web/Webs"}},
"WebInfos":{"__deferred":{"uri":"https://<site url>/_api/Web/WebInfos"}},
"WorkflowAssociations":{"__deferred":{"uri":"https://<site url>/_api/Web/WorkflowAssociations"}},
"WorkflowTemplates":{"__deferred":{"uri":"https://<site url>/_api/Web/WorkflowTemplates"}},
"AllowRssFeeds":true,
"AppInstanceId":"d025f690-8281-4cb7-ab11-04793e232661",
"Configuration":0,
"Created":"2014-02-27T20:08:25",
"CustomMasterUrl":"/_catalogs/masterpage/app.master",
"Description":"",
"DocumentLibraryCalloutOfficeWebAppPreviewersDisabled":false,
"EnableMinimalDownload":false,
"Id":"ba0bfd3d-ba13-4400-aacf-f60d56eecfbc",
"Language":1033,
"LastItemModifiedDate":"2014-02-27T20:08:28Z",
"MasterUrl":"/_catalogs/masterpage/app.master",
"QuickLaunchEnabled":true,
"RecycleBinEnabled":true,
"ServerRelativeUrl":"",
"SyndicationEnabled":true,
"Title":"ParseUm",
"TreeViewEnabled":false,
"UIVersion":15,
"UIVersionConfigurationEnabled":false,
"Url":"https://<site url>",
"WebTemplate":"APP"
}}
WebCollection resource
Endpoint URI | Methods | OData representation
Represents a collection of sites.
Endpoint URI
http://<site url>/_api/web/webs
Supported HTTP methods
GET | POST
Request examples
GET request example: Get all the subsites in a site
$.ajax({
url: "http://<site url>/_api/web/webs",
type: "GET",
headers: { "accept": "application/json;odata=verbose" },
success: successHandler,
error: errorHandler
});
POST request example: Create a site by using the Add method
$.ajax({
url: "http://<site url>/_api/web/webs/add",
type: "POST",
data: "{ 'parameters': { '__metadata': { 'type': 'SP.WebCreationInformation' },
'Title': 'Social Meetup', 'Url': 'social', 'WebTemplate': 'MPS#3',
'UseSamePermissionsAsParentSite': true } }",
headers: {
"X-RequestDigest": <form digest value>,
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"content-length": <length of body data>
},
success: successHandler,
error: errorHandler
});
Or you can use the Add method from the WebInformationCollection resource, as shown in Creating a site with REST.
See Web request examples for examples that show how to change or delete a site.
WebCollection methods
Add method
Adds a new Web site to the collection.
Endpoint |
/add |
Parameters |
|
HTTP method |
POST |
Response |
Type: SP.Web |
Request example
$.ajax({
url: "http://<site url>/_api/web/webs
/add",
type: "POST",
data: "{ 'parameters': { '__metadata': { 'type': 'SP.WebCreationInformation' },
'Title': 'Social Meetup', 'Url': 'social', 'WebTemplate': 'MPS#3',
'UseSamePermissionsAsParentSite': true } }",
headers: {
"X-RequestDigest": <form digest value>,
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"content-length": <length of body data>
},
success: successHandler,
error: errorHandler
});
Use the GetAvailableWebTemplates method to get the names of available site templates.
OData representation
The following example represents a WebCollection resource in JSON format.
{"d":{
"results":[{
"__metadata":{
"id":"https://<site url>/_api/Web",
"uri":"https://<site url>/_api/Web",
"type":"SP.Web"
},
"FirstUniqueAncestorSecurableObject":{"__deferred":{"uri":"https://<site url>/_api/Web/FirstUniqueAncestorSecurableObject"}},
"RoleAssignments":{"__deferred":{"uri":"https://<site url>/_api/Web/RoleAssignments"}},
"AllProperties":{"__deferred":{"uri":"https://<site url>/_api/Web/AllProperties"}},
"AssociatedMemberGroup":{"__deferred":{"uri":"https://<site url>/_api/Web/AssociatedMemberGroup"}},
"AssociatedOwnerGroup":{"__deferred":{"uri":"https://<site url>/_api/Web/AssociatedOwnerGroup"}},
"AssociatedVisitorGroup":{"__deferred":{"uri":"https://<site url>/_api/Web/AssociatedVisitorGroup"}},
"AvailableContentTypes":{"__deferred":{"uri":"https://<site url>/_api/Web/AvailableContentTypes"}},
"AvailableFields":{"__deferred":{"uri":"https://<site url>/_api/Web/AvailableFields"}},
"ContentTypes":{"__deferred":{"uri":"https://<site url>/_api/Web/ContentTypes"}},
"CurrentUser":{"__deferred":{"uri":"https://<site url>/_api/Web/CurrentUser"}},
"DescriptionResource":{"__deferred":{"uri":"https://<site url>/_api/Web/DescriptionResource"}},
"EventReceivers":{"__deferred":{"uri":"https://<site url>/_api/Web/EventReceivers"}},
"Features":{"__deferred":{"uri":"https://<site url>/_api/Web/Features"}},
"Fields":{"__deferred":{"uri":"https://<site url>/_api/Web/Fields"}},
"Folders":{"__deferred":{"uri":"https://<site url>/_api/Web/Folders"}},
"Lists":{"__deferred":{"uri":"https://<site url>/_api/Web/Lists"}},
"ListTemplates":{"__deferred":{"uri":"https://<site url>/_api/Web/ListTemplates"}},
"Navigation":{"__deferred":{"uri":"https://<site url>/_api/Web/Navigation"}},
"ParentWeb":{"__deferred":{"uri":"https://<site url>/_api/Web/ParentWeb"}},
"PushNotificationSubscribers":{"__deferred":{"uri":"https://<site url>/_api/Web/PushNotificationSubscribers"}},
"RecycleBin":{"__deferred":{"uri":"https://<site url>/_api/Web/RecycleBin"}},
"RegionalSettings":{"__deferred":{"uri":"https://<site url>/_api/Web/RegionalSettings"}},
"RoleDefinitions":{"__deferred":{"uri":"https://<site url>/_api/Web/RoleDefinitions"}},
"RootFolder":{"__deferred":{"uri":"https://<site url>/_api/Web/RootFolder"}},
"SiteGroups":{"__deferred":{"uri":"https://<site url>/_api/Web/SiteGroups"}},
"SiteUserInfoList":{"__deferred":{"uri":"https://<site url>/_api/Web/SiteUserInfoList"}},
"SiteUsers":{"__deferred":{"uri":"https://<site url>/_api/Web/SiteUsers"}},
"ThemeInfo":{"__deferred":{"uri":"https://<site url>/_api/Web/ThemeInfo"}},
"TitleResource":{"__deferred":{"uri":"https://<site url>/_api/Web/TitleResource"}},
"UserCustomActions":{"__deferred":{"uri":"https://<site url>/_api/Web/UserCustomActions"}},
"Webs":{"__deferred":{"uri":"https://<site url>/_api/Web/Webs"}},
"WebInfos":{"__deferred":{"uri":"https://<site url>/_api/Web/WebInfos"}},
"WorkflowAssociations":{"__deferred":{"uri":"https://<site url>/_api/Web/WorkflowAssociations"}},
"WorkflowTemplates":{"__deferred":{"uri":"https://<site url>/_api/Web/WorkflowTemplates"}},
"AllowRssFeeds":true,
"AppInstanceId":"9f85a4a6-3609-44d6-9427-e7a5f16ceeeb",
"Configuration":0,
"Created":"2013-10-03T19:45:27",
"CustomMasterUrl":"/apppart/_catalogs/masterpage/app.master",
"Description":"",
"DocumentLibraryCalloutOfficeWebAppPreviewersDisabled":false,
"EnableMinimalDownload":false,
"Id":"2dbf86de-6538-4d1a-b4fe-2a8e9816d692",
"Language":1033,
"LastItemModifiedDate":"2013-10-03T19:45:30Z",
"MasterUrl":"/apppart/_catalogs/masterpage/app.master",
"QuickLaunchEnabled":true,
"RecycleBinEnabled":true,
"ServerRelativeUrl":"/apppart",
"SyndicationEnabled":true,
"Title":"apppart",
"TreeViewEnabled":false,
"UIVersion":15,
"UIVersionConfigurationEnabled":false,
"Url":"https://<site url>",
"WebTemplate":"APP"
},{
"__metadata":{
"id":"https://<site url>,
"uri":"https://<site url>,
"type":"SP.Web"
},
"FirstUniqueAncestorSecurableObject":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/FirstUniqueAncestorSecurableObject"}},
"RoleAssignments":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/RoleAssignments"}},
"AllProperties":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/AllProperties"}},
"AssociatedMemberGroup":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/AssociatedMemberGroup"}},
"AssociatedOwnerGroup":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/AssociatedOwnerGroup"}},
"AssociatedVisitorGroup":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/AssociatedVisitorGroup"}},
"AvailableContentTypes":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/AvailableContentTypes"}},
"AvailableFields":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/AvailableFields"}},
"ContentTypes":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/ContentTypes"}},
"CurrentUser":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/CurrentUser"}},
"DescriptionResource":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/DescriptionResource"}},
"EventReceivers":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/EventReceivers"}},
"Features":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/Features"}},
"Fields":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/Fields"}},
"Folders":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/Folders"}},
"Lists":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/Lists"}},
"ListTemplates":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/ListTemplates"}},
"Navigation":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/Navigation"}},
"ParentWeb":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/ParentWeb"}},
"PushNotificationSubscribers":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/PushNotificationSubscribers"}},
"RecycleBin":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/RecycleBin"}},
"RegionalSettings":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/RegionalSettings"}},
"RoleDefinitions":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/RoleDefinitions"}},
"RootFolder":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/RootFolder"}},
"SiteGroups":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/SiteGroups"}},
"SiteUserInfoList":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/SiteUserInfoList"}},
"SiteUsers":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/SiteUsers"}},
"ThemeInfo":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/ThemeInfo"}},
"TitleResource":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/TitleResource"}},
"UserCustomActions":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/UserCustomActions"}},
"Webs":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/Webs"}},
"WebInfos":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/WebInfos"}},
"WorkflowAssociations":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/WorkflowAssociations"}},
"WorkflowTemplates":{"__deferred":{"uri":"https://<site url>/TeamProjects/_api/Web/WorkflowTemplates"}},
"AllowRssFeeds":true,
"AppInstanceId":"00000000-0000-0000-0000-000000000000",
"Configuration":0,
"Created":"2014-02-28T21:41:11",
"CustomMasterUrl":"/TeamProjects/_catalogs/masterpage/seattle.master",
"Description":"",
"DocumentLibraryCalloutOfficeWebAppPreviewersDisabled":false,
"EnableMinimalDownload":true,
"Id":"3a37226d-8f0b-41bd-a720-6f63fd1e2abb",
"Language":1033,
"LastItemModifiedDate":"2014-02-28T21:41:23Z",
"MasterUrl":"/TeamProjects/_catalogs/masterpage/seattle.master",
"QuickLaunchEnabled":true,
"RecycleBinEnabled":true,
"ServerRelativeUrl":"/TeamProjects",
"SyndicationEnabled":true,
"Title":"Team projects",
"TreeViewEnabled":false,
"UIVersion":15,
"UIVersionConfigurationEnabled":false,
"Url":"https://<site url>/TeamProjects",
"WebTemplate":"STS"
},{
...
}
}]
}}