'PrimitiveValue' node with non-null value was found when trying to read the value of a navigation property;

Praveen Prasannan picture Praveen Prasannan · Jan 24, 2014 · Viewed 22.8k times · Source

How can I save document library lookup field using REST API Post in a SharePoint list? I tried like

'docItem':'1;#test'

But, it is throwing an error :

{
  "error": {
    "code": "-1,Microsoft.SharePoint.Client.InvalidClientQueryException",
    "message": {
      "lang": "en-US",
      "value": "A 'PrimitiveValue' node with non - null value was found when trying to read the value of a navigation property;however, a 'StartArray' node, a 'StartObject' node, or a 'PrimitiveValue' node with null value was expected."
    }
  }
}

Bad Request

Answer

Aleksi Niiranen picture Aleksi Niiranen · Jan 31, 2014

Assuming the lookup field name is docItem simply using

'docItemId':1

will do the trick.