2

I try to add a list item via the SharePoint 2013 REST API (in Objective C) and keep getting the following error:

{
"error":{
"code":"-1, System.InvalidOperationException",
"message":{
"lang":"en-US",
"value":"The required version of WcfDataServices is missing. Please refer to http://go.microsoft.com/fwlink/?LinkId=321931 for more information."
}}}

Authentication works just fine, I am also able to retrieve lists.

I access the following url:

<sharepointurl>/_api/web/lists/getbytitle(%27Announcements%27)/items

and provide the following data:

Header:

X-RequestDigest
Accept

Data:

{
'_metadata':{'type':'SP.AnnouncementsListItem},
'Title':'Posting to Sharepoint API'
}

Http-Method:

POST

Unfortunately I cannot find any information when googling the error I am receiving.

Has anyone faced this error and can help me?

Thanks & kind regards.

4

Please see link below. The fix for me was to add header “Content-Type” = “application/json;odata=verbose”

https://stackoverflow.com/questions/25415427/create-a-folder-in-sp2013-using-rest-and-httpclient

0

Okay, I tried on another freshly installed SharePoint and it works without issues.

Possibly some configuration problem.

0

I resolved this simply by X-Requested-With: XMLHttpRequest to my header. Unfortunately it does not appear in microsoft's documentation here https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest and it cost me a lot of time.

I found it by tracing my older projects that used AJAX to communicate with SharePoint 2013 on-prem.


{
   "Accept":"application/json; odata=verbose",
   "Content-Type":"application/json; odata=verbose",
   "X-RequestDigest": "`[FORM DIGEST]`",
   "IF-MATCH":"*",
   "X-HTTP-Method":" DELETE",
   "X-Requested-With":"XMLHttpRequest"
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.