Logo
  • Contact form
  • Events & slides
  • Buy me a snack
👋🏻
HTTP request to SharePoint - Term Store

HTTP request to SharePoint - Term Store

  • What is the term store?
  • Reading the term store
  • Getting term sets
  • Getting specific terms with filter
  • Getting terms (level 1)
  • Getting terms (level 2)
  • Creating Terms
  • Update Terms
  • Update Terms - Available for Tagging
☝
TL;DR - The term store in SharePoint Online allows you to create site-level choices with a hierarchal structure. Instead of having simple dropdown, you can use terms to further refine your data with metadata, even in multiple languages. You can manage it from the term store management page or with Power Automate connecting directly to the API, reading or creating sets and terms.

What is the term store?

The Term Store in SharePoint Online is a feature used for managing metadata. It allows you to create and manage terms in a hierarchical structure, which can be used across your SharePoint sites to ensure consistent tagging and categorization of content. A term store can be set up tenant wide as well as per site collection.

Within the term store you will find Term sets and Terms:

  • Term sets are used to group terms that are related to a specific category or topic
  • Terms are individual items within a term set. Each term represents a specific value or keyword that can be used to tag content.

Reading the term store

Getting term sets

A set is the highest level in the term store. It is more like a header for the choices and not selectable by the user.

Method: GET
Uri: _api/v2.1/termStore/groups/TERM STORE GUID/sets
Headers:
{
 "Accept": "application/json; odata=verbose",
 "Content-Type": "application/json; odata=verbose"
}

Getting specific terms with filter

A term is a value, that the user can select from the UI. It has a hierarchy and can down to multiple levels.

Method: GET
Uri: _api/v2.1/termStore/groups/TERM STORE GUID/sets/TERM SET GUID/terms?$filter=id eq 'TERM GUID'
Headers:
{
 "Accept": "application/json; odata=verbose",
 "Content-Type": "application/json; odata=verbose"
}

Getting terms (level 1)

Method: GET
Uri: _api/v2.1/termStore/groups/TERM STORE GUID/sets/TERM SET GUID/terms
Headers:
{
 "Accept": "application/json; odata=verbose",
 "Content-Type": "application/json; odata=verbose"
}
‣
Sample output (redacted)

Getting terms (level 2)

Method: GET
Uri: _api/v2.1/termStore/groups/TERM STORE GUID/sets/TERM SET GUID/terms/TERM GUID/terms
Headers:
{
 "Accept": "application/json; odata=verbose",
 "Content-Type": "application/json; odata=verbose"
}

Creating Terms

Each term inside the term store will has a display name, optional synonyms and an optional description. If you need to add multiple languages with each their own properties, adjust the body JSON.

‣
Sample output (redacted)

Update Terms

The body is the same to update, make sure you change the URL and your method.

Update Terms - Available for Tagging

Tagging is usually set to true, since you want to use your term with your documents. If you want to disable your term before you delete it, you can set the tagging to false. It will appear greyed out. If you decide to delete your term directly, the term will also be removed from all documents. To reactivate a term, simply set the isAvailable property to true.

Method: PATCH
Uri: _api/v2.1/termStore/groups/TERM STORE GUID/sets/TERM SET GUID/terms/TERM GUID
Headers:
{
 "Accept": "application/json; odata=verbose",
 "Content-Type": "application/json; odata=verbose"
}
Body: {
  "isAvailableForTagging": [
    {
      "setId": "PARENT SET ID",
      "isAvailable": false
    }
  ]
}
Logo

Events & slides

Buy me a snack

Contact form

Data privacy policy

About

This blog is made with ♥️ on Notion and made public with Super.so. Rocket icon created by RIkas Dzihab - Flaticon.

RedditLinkedIn
Method: POST
Uri: _api/v2.1/termStore/groups/TERM STORE GUID/sets/TERM SET GUID/children
Headers:
{
 "Accept": "application/json; odata=verbose",
 "Content-Type": "application/json; odata=verbose"
}
Body: {
  "labels": [
    {
      "name": "DISPLAYNAME",
      "isDefault": true,
      "languageTag": "en-US"
    },
    {
      "name": "SYNONYM NAME",
      "isDefault": false,
      "languageTag": "en-US"
    }
  ],
  "descriptions": [
    {
      "description": "DESCRIPTION TEXT",
      "languageTag": "en-US"
    }
  ]
}
Method: PATCH
Uri: _api/v2.1/termStore/groups/TERM STORE GUID/sets/TERM SET GUID/terms/TERM GUID
Headers:
{
 "Accept": "application/json; odata=verbose",
 "Content-Type": "application/json; odata=verbose"
}
Body: {
  "labels": [
    {
      "name": "DISPLAYNAME",
      "isDefault": true,
      "languageTag": "en-US"
    },
    {
      "name": "SYNONYM NAME",
      "isDefault": false,
      "languageTag": "en-US"
    }
  ],
  "descriptions": [
    {
      "description": "DESCRIPTION TEXT",
      "languageTag": "en-US"
    }
  ]
}