0

I want to update items in a link list. Part of is automatic generation of an URL. That URL should provide an alternative text. So I know, I have to formulate an http request instead of the update item action.

I read through different websites and followed the instruction here:

Update hyperlink column on tachytelic.net

List name is "DCDC-RMTick".

I formulated a POST request:

{
   "__metadata": {
    "type": "SP.Data.DCDC-RMTickListItem"
   },
   "URL": {
       "Description": "#0000",
       "Url": "https://smt-redmine.mycompany.com/redmine/issues/0000"
   }
}

I get an error (unfortunately for you in German) complaining that the type could not be resolved by the model (if I translated it correctly).

The error code:

{
  "status": 400,
  "message": "Ein Typ mit dem Namen \"SP.Data.DCDC-RMTickListItem\" konnte vom Modell nicht aufgelöst 
              werden. Wenn ein Modell verfügbar ist, muss jeder Typname in einen gültigen Typ aufgelöst werden können.\r\nclientRequestId: b6ec4ad8-7a0d-48a5-890a-2b001a76e34f\r\nserviceRequestId: 0f1fc79f-d067-c000-0106-3de89df59262",
  "source": "https://mycompany.sharepoint.com/sites/O3.33400Illu/_api/web/lists/GetByTitle('DCDC-RMTick')/items(19)",
  "errors": [
              "-1",
              "Microsoft.SharePoint.Client.InvalidClientQueryException"
            ]
}

For the sake of completeness some screenshots:

enter image description here

enter image description here

Do I have to supply a different content type than "ListItem"?

The content type of the URL list is "Verknüpfung" (probably link in English), which is the standard for link lists in SP. Or is there something different I have botched?

1 Answer 1

1

Make sure you are passing correct ListItemEntityTypeFullName in type property inside __metadata.

You can check ListItemEntityTypeFullName of your list using below URL:

<siteUrl>/_api/web/lists/GetByTitle('listName')/ListItemEntityTypeFullName

Common Format of ListItemEntityTypeFullName:

SP.Data.ListNameListItem

Replace only ListName with your list name.

For more information, check: Pass file name having space to update operation using REST API

Update from comments:

You need to pass the URL in below format with the site URL (check below image):

enter image description here

And you need to use the highlighted value in type property. In my case, it is SP.Data.Test_x005f_ListListItem.

4
  • If I enter the URL in browser I get <m:error xmlns:m="schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <m:code>-1, Microsoft.SharePoint.Client.InvalidClientQueryException</m:code> <m:message xml:lang="de-DE">Der Ausdruck "web/lists/GetByTitle('DCDC-RMTick')/SP.Data.DCDC-RMTickListItem" ist ungültig.</m:message> </m:error> Commented May 12, 2021 at 10:04
  • Do I have to supply the full path to the list in that URL? I used only the site as URL before /_api... Commented May 12, 2021 at 10:05
  • Sorry, I was too stupid to read and understand your post at first glance. I think I have to omit the dash. I'm reporting back as soon as I have tested. Commented May 12, 2021 at 10:09
  • Yes, you need to enter the URL in this format: https://<your-tenant-name>.sharepoint.com/sites/<site-name>/_api/web/lists/GetByTitle('<list-name>')/ListItemEntityTypeFullName. Check updated answer for more information. Commented May 12, 2021 at 10:12

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.