Thursday, 15 July 2010

Adding list items with SharePoint 2013 REST API -



Adding list items with SharePoint 2013 REST API -

i'm trying add together new item in existing list using sharepoint 2013 rest api.

there pretty documentation here: http://msdn.microsoft.com/en-us/library/jj164022(office.15).aspx#listitems

the list trying add together items called "resources", next http post operation add together 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 next error:

a type named 'sp.data.resourceslistitem' not resolved model. when model available, each type name must resolve valid type.

so presume don't have right name name resource. in documentation, says:

to operation, must know listitementitytypefullname property of list , pass value of type in http request body.

but don't know how listitementitytypefullname list, , documentation not seem explain how-- copied pattern doc (sp.data.< list_name >listitem") guess not right.

how can find name list?

you can name follows:

get https://<site>/apps/reserve/_api/lists/getbytitle('resources')?$select=listitementitytypefullname

the list name under: content -> m:properties -> d:listitementitytypefullname

rest sharepoint sharepoint-api sharepoint-2013

No comments:

Post a Comment