Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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?

share|improve this question

1 Answer

up vote 2 down vote accepted

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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