I have issue with my query to post item on test list, it returns 400 error. My list columns:
Title | user
Here is my body of json:
const body: string = JSON.stringify({
"__metadata": {
"type": "SP.Data.TestInsertPersonListItem"
},
"Title": "test",
"user": {
"__metadata": {
"type": "SP.Data.UserInfoItem"
},
"Id": 8,
}
});
return this.props.spHttpClient.post(`tenant.com/sites/randomsite/_api/web/lists/getbytitle('TestInsertPerson')/items`,
SPHttpClient.configurations.v1,
{
headers: {
'Accept': 'application/json;odata=nometadata',
'Content-type': 'application/json;odata=verbose',
'odata-version': ''
},
body: body
});
})
and it returns 400 error with error:
A type named 'SP.Data.UserInfoItem' could not be resolved by the model. When a model is available, each type name must resolve to a valid type.
When I leave only Title it works as expected. Does anybody face similiar problem and deal with it ?