I'm creating a favoriting system, where each time a user favorites an item, an item in a secondary list is created with that item's ID number and the user's alias. On a separate page, I will use that list to get all the item IDs with that user's alias, and list each item.

Here I specify the URL for the list, and the ID and alias:

var apiUrl = webUrl + "/_api/Web/Lists/getbytitle('Favorites')";
var data = {
   'ID': itemID,
   'UserAlias': user.LoginName.split('\\')[1]

Here the API is called:

   method: 'POST',
   url: apiUrl,
   headers: {
      "accept": "application/json;odata=verbose",
      "X-RequestDigest": $("#__REQUESTDIGEST").val(),
      "content-Type": "application/json;odata=verbose"
   data: JSON.stringify(data)

However, Sharepoint returns error 400 (Bad Request) and the following message:

"The parameter ID does not exist in method GetByTitle"

How do I set the ID of the new item? And if that's not possible and I need to use a separate ID column, how can I retrieve items by the new column for deletion and listing?

1 Answer 1


I resolved my problem by adding /items to the end of my URL, and adding the metadata type information.

e.g. var apiUrl = webUrl + "/_api/Web/Lists/getbytitle('Favorites')/items";


var data = {
  'ID': itemID,
  'UserAlias': user.LoginName.split('\\')[1],
  '__metadata': { "type": "SP.Data.FavoritesListItem" }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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