Skip to content

Instantly share code, notes, and snippets.

@pkskelly
Created May 9, 2018 17:57
Show Gist options
  • Save pkskelly/41031ee7ecaca1f06e3898c58b1c0820 to your computer and use it in GitHub Desktop.
Save pkskelly/41031ee7ecaca1f06e3898c58b1c0820 to your computer and use it in GitHub Desktop.
Template for HubSite REST Calls. You can copy this file, load the REST Client Extension in VS Code and run the samples. Some configuration and knowledge of OAuth is required.

@host = tenant-name @hubname = hubsite-name @token = Bearer bearer-toekn-value @hubid = hub-id @spokeid = spoke-id @company = your-company

### CanCreate - determine if current user can create a hubsite GET https://{{host}}-admin.sharepoint.com/_api/sp.hubsites.cancreate Accept: application/json Authorization: {{token}} User-Agent:NONISV|{{company}}|testing

### GetById - Get HubSite By ID GET https://{{host}}-admin.sharepoint.com/_api/hubsites/getbyId?hubSiteId='{{spokeid}}' Accept: application/json Authorization: {{token}} User-Agent:NONISV|{{company}}|testing

### HubSiteData - Get HubSite Data (requires access token specific to audience (host) GET https://{{host}}.sharepoint.com/sites/hr/_api/web/HubSiteData(true) Accept: application/json Authorization: {{token}} User-Agent:NONISV|{{company}}|testing

### List HubSites GET https://{{host}}-admin.sharepoint.com/_api/hubsites Accept: application/json Authorization: {{token}} User-Agent:NONISV|{{company}}|testing

### JoinHubSite - connect a site to HubSite POST https://{{host}}.sharepoint.com/sites/team6/_api/site/JoinHubSite('{{hubid}}') Accept: application/json Authorization: {{token}} User-Agent:NONISV|{{company}}|testing

### JoinHubSite - disconnect from a HubSite POST https://{{host}}.sharepoint.com/sites/team6/_api/site/JoinHubSite('00000000-0000-0000-0000-000000000000') Accept: application/json Authorization: {{token}} User-Agent:NONISV|{{company}}|testing

### RegisterHubSite POST https://{{host}}.sharepoint.com/sites/{{hubname}}/_api/site/RegisterHubSite Accept: application/json Authorization: {{token}} User-Agent:NONISV|{{company}}|testing

### UnRegisterHubSite POST https://{{host}}.sharepoint.com/sites/{{hubname}}/_api/site/UnregisterHubSite Accept: application/json Authorization: {{token}} User-Agent:NONISV|{{company}}|testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment