SharePoint Online - REST API - Select Taxonomy Field

You can perform basic create, read, update, and delete (CRUD) operations by using the Representational State Transfer (REST) interface provided by SharePoint. The REST interface exposes all the SharePoint entities and operations that are available in the other SharePoint client APIs. One advantage of using REST is that you don’t have to add references to any SharePoint libraries or client assemblies. Instead, you make HTTP requests to the appropriate endpoints to retrieve or update SharePoint entities, such as webs, lists, and list items.

If you have a requirement to select a taxonomy field from SharePoint Designer workflow using Call HTTP action, it is not a straightforward approach. The below article is going to talk about few workarounds for this problem.

My List

SharePoint Online - REST API - Select Taxonomy Field 

Note
Job Title is a Taxonomy field.

Problem 1

The SELECT query will not return Taxonomy Term Label.

SharePoint Online - REST API - Select Taxonomy Field 

Problem 2

The Filter query cannot be applied against the Taxonomy field.

 

SharePoint Online - REST API - Select Taxonomy Field

 

Solution 1 - CAML Based REST Call

The following POST query helps you to get the necessary results but the problem with this approach is that we can not call this REST Endpoint from SharePoint Designer workflow as it contains curly braces and curly braces are used as tokens in SharePoint Designer.

 

SharePoint Online - REST API - Select Taxonomy Field

 

Solution 2

Query the Taxonomy field value using GUID associated with the Taxonomy TextField.

This will be a 3 step process.

Step 1 - Get the TextField(hidden note field) value of the Taxonomy Field

Execute the following REST call and note down the TextField value from the REST response.

 

SharePoint Online - REST API - Select Taxonomy Field

 

Step 2 - Get the InternalName of the TextField

Pass the GUID of the TextField received from step 1 in the below REST call and get the InternalName of the same.

 

SharePoint Online - REST API - Select Taxonomy Field

 

Step 3

Get the Taxonomy field value passing InternalName, as shown below.

 

SharePoint Online - REST API - Select Taxonomy Field

 

Applying filters against this internal field also leads to the same problem.

“The field ‘g9d8145fb42b43f59dd422adf7bbb575’ of type ‘Note’ cannot be used in the query filter expression. ”

A workaround will be to create an additional single line of text field in the list and populate the same with the taxonomy field value and use the same to apply a filter as shown below.

https://yourtenant.sharepoint.com/sites/dev/_api/web/lists/getbytitle(‘Employee Details’)/items?$select=g9d8145fb42b43f59dd422adf7bbb575&$filter=ExtraField eq ‘CEO|6c47210d-44d3-496e-82a3-aaac11a3b94b’
 
Please let me know if you have any questions on this.