Hub site REST API
You can use the SharePoint REST interface to register sites as hub sites, associate existing sites with hub sites, and obtain or update information about hub sites.
The SharePoint Online (and SharePoint 2016 and later on-premises) 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.
Prerequisites
Before you get started, make sure that you're familiar with the following:
REST commands
The following REST commands are available for working with hub sites:
- SP.HubSites.CanCreate – Returns whether the current user can create a hub site. Only tenant admins can create hub sites.
- GetById – Gets or updates information about a hub site.
- HubSiteData – Gets hub site data for the current web.
- HubSites – Gets information about all hub sites that the current user can access.
- JoinHubSite – Associates a site with an existing hub site.
- RegisterHubSite – Registers an existing site as a hub site.
- SyncHubSiteTheme – Applies any theme updates from the parent hub site.
- UnRegisterHubSite – Unregisters a hub site so that it is no longer a hub site.
- SPHubSite object type – Contains data describing a SharePoint hub site.
- SPHubSiteData object type – Contains data describing a SharePoint hub site.
Scenarios
Some of the following scenario examples are not intuitive from the method name. See each cmdlet article for more details.
Update a hub site
Call the GetById method to update a hub site.
Disassociate a site from its hub site
To remove, or disassociate a site from a hub site, call JoinHubSite with the value "00000000-0000-0000-0000-000000000000".
See also
Feedback
Submit and view feedback for