Problem:
I have list names “Experts” with a Metadata Column as ContosoLevel. When I retrieve the column via REST call I get only following in the response for the column.
“ContosoLevel”:{“__metadata”:{“type”:”SP.Taxonomy.TaxonomyFieldValue”},“Label”:”1″,”TermGuid”:”47dd115d-7399-46d1-b985-205e499bbbdd”,”WssId”:1}
I was expecting the Label field will have the term value.
REST Call: GET /sites/PankajSandBox/_api/web/lists/getByTitle(‘Experts’)/items
Also I noticed that when I change the column as MultiSelect, the REST call works.
Solution:
The solution to use the POST method with the CAML query. The single select values will be returned. Please make sure you pass the “X-RequestDigest” value in your POST request.
Once I followed the steps. I was able to get the values as following.
“ContosoLevel”:{“__metadata”:{“type”:”Collection(SP.Taxonomy.TaxonomyFieldValue)”},”results”:[{“Label”:”Chief Engineer”,”TermGuid”:”47dd115d-7399-46d1-b985-205e499bbbdd”,”WssId”:1}]}
REST Call: POST /sites/PankajSandBox/_api/web/lists/getByTitle(‘Experts’)/GetItems(query=@v1)?@v1={‘ViewXml’:'<View><Query></Query></View>’}
Please see the following blog which helped me.
“Also I noticed that when I change the column as MultiSelect, the REST call works”, Thanks for the sentence it saved my day !