3

I have a list with spaces in its name as Teams%20List

$.ajax({
        url: parts[0]+"/_api/web/lists/GetByTitle('Teams%20List')/Items",
        type: "POST",
        data:  JSON.stringify({ '__metadata': { 'type': 'SP.Data.Teams%20ListListItem' }, 
             'Title': data.d.results[k].Title}),

and thus the code does not work.

what do I need to do for 'SP.Data.Teams%20ListListItem' part.

8

Remove %20 and try it will work

{ '__metadata': { 'type': 'SP.Data.TeamsListListItem' }, 'Title': data.d.results[k].Title}

If not then

1) Open any browser

2) http://urlsiteurl/_api/web/lists/GetByTitle('Teams%20List')/?$select=ListItemEntityTypeFullName

3) Now paste the value of it and try

1
  • 1
    Confirmed - this will get you the entity name. It replaces spaces using the normal XML replacement we see in Field names - x0020. OP's entity name will be SP.Data.Teams_x0020_ListListItem.
    – James Love
    Nov 16 '15 at 14:29
1

If you have a space you have to encode it to x0020 to become "SP.Data.Teams_x0020_ListListItem"

0

Tried it without %20? SP.Data.TeamsListListItem

1
  • It does not work
    – KumarV
    Nov 16 '15 at 14:12
0

Try :

JSON.stringify({ '__metadata': { 'type': 'SP.List'},

2
  • It doesn't work..
    – KumarV
    Nov 16 '15 at 14:18
  • What is the response (header)?
    – Dave
    Nov 16 '15 at 14:24

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.