Table of contents
- General
- Hub site and its children
- Getting a site i
- Site and list fields / columns
- Get columns
- Get columns by internal name or title
- Create (site/list) fields
- Modify (site/list) fields
- Delete (site/list) fields
- Lists
- Get the relative url of a list
- Create list or modify list settings
- Deleting a list
- Content types
- Get all list content types
- Create list content type
- Modify existing list content type
- Enable modern form for document sets
- Content type fields
- Get list content type fields
- Remove list content type fields
- Views
- Get list views
- List view fields
- Changelog
General
Hub site and its children
Getting a site i
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 and list fields / columns
Site and list columns use identical request bodies. Therefore, they are mentioned here together. Make sure you use the correct URI for your use case.
Get columns
Something to look out for is the StaticName property. This shows the fields internal name.
Get columns by internal name or title
_api/web/fields/GetByInternalNameOrTitle
Headers:
{
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose"
}
Result: Object
body('ACTIONNAME')?['d']Create (site/list) fields
Each field has its own type and therefore, unique properties. Make yourself familiar with their properties.
General info: https://learn.microsoft.com/en-us/dotnet/api/microsoft.sharepoint.client.field?view=sharepoint-csom
Always use the corresponding metadata type for the field; e.g. Number = SP.FieldNumber, DateTime = SP.FieldDateTime
Currently this method does not support creating a lookup field.
Modify (site/list) fields
StaticName and InternalName cannot be changed after a column was created. Only other properties like Required can be changed.
Changing shared properties like Title or Required, you can use SP.Field for the metadata type. If you are changing field specific properties, use the corresponding SP.FieldType (See list above).
Delete (site/list) fields
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
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
//all lists
Uri: _api/web/lists
//specific list
_api/web/lists('LIST GUID')
Uri:
Headers:
{
"accept": "application/json;odata=verbose",
"content-type ": "application/json;odata=verbose"
}
Result: body('ACTIONNAME')?['d']?['results']Get the relative url of a list
Method: GET
Uri: _api/web/lists('LIST GUID')?$select=Id,Title,RootFolder/ServerRelativeUrl&$expand=RootFolder
Result: body('HTTP ACTION NAME')?['d/RootFolder/ServerRelativeUrl']Create list or modify list settings
Source: https://learn.microsoft.com/en-us/previous-versions/office/sharepoint-visio/jj245826(v=office.15)
BaseTemplate: 100 = List, 101 = Library. Adding these exact headers is very important!
Deleting a list
Method: DELETE
Uri: _api/web/lists('LISTGUID')
Headers:
{
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose"
}Content types
Get all list content types
Supports: Select, Filter
Method: GET
Uri: _api/web/Lists('LISTGUID')/ContentTypes
Result: body('ACTIONNAME')?['d']?['results']Create list content type
Method: POST
Uri: _api/web/Lists(guid'LISTGUID')/ContentTypes
Body:
{
"__metadata": {
"type": "SP.ContentType"
},
"Name": "New Content Type",
"Description": "New Content Type Description",
"Group": "Custom Content Type Group"
}Modify existing list content type
Enable modern form for document sets
THIS IS NOT REVERSIBLE. As this a change on library level, the only way to undo this change is to delete the content type from the library and add it again. Make sure this is well thought out, best case would be to do this right at the beginning of whatever you are building.
Content type fields
Get list content type fields
This would be part of a loop based on listing the content types.
Method: GET
Uri: _api/web/Lists('LIST GUID')/ContentTypes('item()?['StringId']}')/fields
Result: body('ACTIONNAME')?['d']?['results']Remove list content type fields
Seems like its not possible now. I tried this:
Method: POST
Uri: _api/web/Lists('LIST GUID')/ContentTypes('item()?['StringId']}')/fields/getbyid('FIELD ID')
Headers:
{
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose",
"IF-MATCH": "*",
"X-HTTP-Method": "DELETE"
}Views
Get list views
Method: GET
Uri: _api/web/lists(guid'LISTGUID')/Views
Result: body('ACTIONNAME')?['d']?['results']
//to get the default view and its id
Uri: _api/web/lists(guid'LISTGUID')/Views?$filter=DefaultView eq true
Result: first(body('ACTIONNAME')?['d']?['results'])?['Id']List view fields
This would be a part of a loop based on listing the views.
Method: GET
Uri: _api/web/lists(guid'LISTGUID')/Views(guid'item()?['Id']')/ViewFields
Result: body('ACTIONNAME')?['d']?['results']Changelog
Date | Changes |
07.09.2025 | Added remove field from list content type, not possible atm. |
27.02.2026 | Get the relative url of a list with example output |
30.04.2026 | Updated field and column section |
Thanks for reading! 💕