Properly Retrieve SIngle-Select Managed Metadata Field Using REST

Some time ago I came across this very interesting piece of information of properly retrieving a single-select managed metadata column value.
 
The following is the reference of the article: TAXONOMY COLUMNS & SHAREPOINT 2013 LIST REST API 
  
This scenario is applicable to retrieving a single-select managed metadata column value using any method (managed code, JavaScript REST and so on) and not only limited to provider-hosted apps.
 
Let us first try to fetch the value of a managed metadata column that allows adding multiple values to it. I have created a simple taxonomy term set called "Countries".
 
 
 
A custom list that contains a column "Country" that is a Managed Metadata column and allows multiple values to be added.
 
 
 
The list contains the following values for testing:
 
 
 
Now we try to fetch the list items from this list using the REST API from the provider-hosted app. To use the REST API from the provider hosted app, we need to send the access token in the REST request. This will be used by SharePoint to authorize the call.
 
 
 
We have written the JSON response on our page and we can see that the label of the taxonomy field is retrieved properly.
 
 
Now If I change the managed metadata setting to single-select, we see the following difference:
 
 
 
 
 
 To retrieve this value properly, we need to make use of the GetItems method and SPQuery in the REST request.
 
And the value will be properly retrieved.
 
 
 
References:

Up Next
    Ebook Download
    View all
    Learn
    View all