Table of contents
Hub site and its children
//first get the hubsiteid
Method: GET
Uri: /_api/site?$select=IsHubSite,HubSiteId
Result: body('Send_an_HTTP_request_to_SharePoint_-_Hub_Site_Id')?['d']?['HubSiteId']
//use result in another http action, by default the api will return a paged array. Using the top parameters gives you all sites in a single array. The service limit for assigning children to a hub is 500.
_api/v2.1/sites?$filter=sharepointIds/hubSiteId eq 'HUBSITEID'&$top=500
Getting a site id
This return an id property that contains three parts separated by commas. The second value is the site id.
_api/v2.0/sites/tenant.sharepoint.com:/sites/Training:/
Site columns
Method: GET
Uri: _api/web/fields
Result: body('ACTIONNAME')?['d']?['results']
Lists
Something to look out for is the BaseType, 0 = List, 1 = Library
Sadly, this endpoint does not directly support filtering. You could use something like “GetByTitle(’SitePages’)” instead.
Method: GET
Uri: _api/web/lists
Headers:
{
"accept": "application/json;odata=verbose",
"content-type ": "application/json;odata=verbose"
}
Result: body('ACTIONNAME')?['d']?['results']
//Title will describe the lists displayname
//EntityTypeName the lists internal name, how it appears in the url
List fields
Something to look out for is the StaticName property. This shows the fields internal name.
Method: GET
Uri: _api/web/lists(guid'LISTGUID')/fields
//also works with select and filter
_api/web/lists(guid'LISTGUID')/fields?$select=__metadata,Title,FieldTypeKind,Required,EnforceUniqueValues,StaticName,Hidden&$filter=Hidden eq false
_api/web/lists/getByTitle('My list')/fields?$select=id,Title
Result: body('ACTIONNAME')?['d']?['results']
List content types
Method: GET
Uri: _api/web/Lists(guid'LISTGUID')/ContentTypes
Result: body('ACTIONNAME')?['d']?['results']
Content type fields
This would be part of a loop based on listing the content types.
Method: GET
Uri: _api/web/Lists(guid'LISTGUID')/ContentTypes('item()?['StringId']}')/fields
Result: body('ACTIONNAME')?['d']?['results']
List views
Method: GET
Uri: _api/web/lists/Views
Result: body('ACTIONNAME')?['d']?['results']
List view fields
This would be a part of a loop based on listing the views.
Method: GET
Uri: _api/web/lists/Views(guid'item()?['Id']')/ViewFields
Result: body('ACTIONNAME')?['d']?['results']
Other content
https://ludovicperrichon.com/sharepoint-rest-api-call-with-powerautomate/#introduction
Create lists or libraries
BaseTemplate 100 = List, 101 = Library
Adding these exact headers is very important!
Uri:
Method: POST
Header:
{
"accept": "application/json;odata=verbose",
"content-type ": "application/json;odata=verbose"
}
Body:
{
"__metadata": {
"type": "SP.List"
},
"AllowContentTypes": true,
"BaseTemplate": 100,
"ContentTypesEnabled": true,
"Description": "My list description",
"Title": "Test"
}
Delete list columns
Sometimes the action will return an error saying that the field cannot be found, this is wrong. If you can see in the UI, its there. In that case you will need to use the field id instead of the title. To do that
Method: POST
Uri: _api/web/lists/getByTitle('My list')/fields/getbytitle('My column')
With field id: _api/web/lists/getByTitle('Planner Kanban')/fields/getbyid('field guid')
Headers:
{
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose",
"IF-MATCH": "*",
"X-HTTP-Method": "DELETE"
}
Thanks for reading! 💕