0

While quering with the CAML query in the SharePoint REST API throws following error.

{ "error": { "code": "-1, Microsoft.Data.OData.ODataException", "message": { "lang": "en-US", "value": "Invalid JSON. A comma character ',' was expected in scope 'Object'. Every two elements in an array and properties of an object must be separated by commas." } } } 

Request: ../sites/POCs/_api/web/lists/getByTitle('TestList2')/GetItems(query=@v1)?@v1={'ViewXml':'2'} Request Headers and request

    1 Answer 1

    0

    The issue was the CAML which is passing in the GetItems query. Simply you can replace single quote with double quote, further means that in CAML is XML based query language and you need to provide attributes within the double quotes.

    Request CAML Sould be as follows;

    ../sites/POCs/_api/web/lists/getByTitle('TestList2')/GetItems(query=@v1)?@v1={'ViewXml':'<View><Query><Where><Eq><FieldRef Name=***"ID"***></FieldRef><Value Type=***"Number"***>2</Value></Eq></Where></Query></View>'} 

      Start asking to get answers

      Find the answer to your question by asking.

      Ask question

      Explore related questions

      See similar questions with these tags.