I'm trying to add a new item in a existing list using SharePoint 2013 with the REST API.
There is pretty good documentation for this here: http://msdn.microsoft.com/en-us/library/jj164022(office.15).aspx#ListItems
The list I am trying to add items to is called "Resources", so I do the following http POST operation to add the new item:
POST https://<site>/apps/reserve/_api/lists/getbytitle('Resources')/items X-RequestDigest: <digest_key> Content-Type: application/json;odata=verbose { "__metadata": {"type": "SP.Data.ResourcesListItem"}, "Title": "New Title", "Description": "New Description", "Location": "Sunnyvale" }
But I get back the following error:
A type named 'SP.Data.ResourcesListItem' could not be resolved by the model. When a model is available, each type name must resolve to a valid type.
So I presume I don't have the correct name for the name for the resource. In the documentation, it says:
To do this operation, you must know the ListItemEntityTypeFullName property of the list and pass that as the value of type in the HTTP request body.
But I don't know how to get the ListItemEntityTypeFullName for my list, and the documentation does not seem explain how-- I copied the pattern from the doc (SP.Data.< LIST_NAME >ListItem") but I guess that is not right.
How can I find the name for my list?
SharePoint Rest API CRUD Operations – Video TutorialCreate site column in SharePoint using Rest API. Create, Update and Delete SharePoint List using Rest API. Retrieve SharePoint list items programmatically using jsom, rest api and csom. How to display dynamic contents into a page using Rest API in SharePoint Online.
You can get the name as follows:
GET https://<site>/apps/reserve/_api/lists/getbytitle('Resources')?$select=ListItemEntityTypeFullName
The list name will be under: content -> m:properties -> d:ListItemEntityTypeFullName
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With