I need to update the some columns(EmpId,DocumentDate,PRType,Commnunity) in my document library.Out of which PRType & Community is managed metadata column. All works file and updated when I update only EmpId & DocumentDate, but as soon as I added "PRType":{'label':'TermName','TermGuid':'GUID of Term','WssId':-1} & Community in my metadata to update it gives 400 error. So metadata column not updated, where I went wrong in updating the metadata column.
var fileUrl=`https://xxxxx.sharepoint.com/sites/TestSite/_api/Web/Lists/getByTitle('Drop%20Off%20Library')/Items(id)`;
const body = {
'__metadata': { 'type': 'SP.Data.DropOffLibraryItem' }, "EmpId": "021345","DocumentDate":"Date"
,"PRType":{'label':'TermName','TermGuid':'GUID of Term','WssId':-1}
,"Community":{'label':'TermName','TermGuid':'GUID of Term','WssId':-1}
};
let spOpts1 : ISPHttpClientOptions = {
headers: {
'IF-MATCH': '*',
'Content-type': 'application/json;odata=verbose',
"accept": "application/json;odata=verbose",
"odata-version":"3.0",
'X-HTTP-Method': 'MERGE'
},
body: JSON.stringify(body)
};
this.props.context.spHttpClient.post(fileUrl,SPHttpClient.configurations.v1,spOpts1).then((response: SPHttpClientResponse) => {
alert(response.status + ':' + response.ok);
})
}```