cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Marty_88
New Member

Updating Document Library Title HTTP Request

Hi,

 

I am trying to update a Document Library name/title via the HTTP Request following the Working with lists and list items with REST | Microsoft Docs 

 

 

POST https://{site_url}/_api/web/lists(guid'{list_guid}')
Authorization: "Bearer " + accessToken
Accept: "application/json;odata=verbose"
Content-Type: "application/json"
Content-Length: {length of request body as integer}
If-Match: "{etag or *}"
X-HTTP-Method: "MERGE"
X-RequestDigest: "{form_digest_value}"

{
  "__metadata": {
    "type": "SP.List"
  },
  "Title": "New title"
}

 

 

I have done this in flow as below; 

Marty_88_0-1652790625060.png

 

But get this error below;

Marty_88_1-1652790166392.png

 

 

When I run the step without the body i see that I am getting an correct response back from SP..

 

Any ideas?

 

Thanks

 

 

5 REPLIES 5
shoog
Dual Super User
Dual Super User

We can only use the GetByTitle function in a GET action.

You should split your action into two seperate actions:

The first to get the item ID you want to modify using the GetByTitle function,

the second to update the item but with the _api/Web/lists(guid'<guid>') url where <guid> refers to the Id field of the output of the first action.

Hi @shoog 
Thanks for this, I have now been able to capture the ID from the first action, but when i have updated the second action I also still have an error;

 

Marty_88_0-1652963021335.png

Error

Marty_88_1-1652963099317.png

 

Thanks for your time

 

shoog
Dual Super User
Dual Super User

You could modify the body of your request to something like this (please not the single quotes in stead of double), type should be SP.List

{
  '__metadata': {
    'type':'SP.List'
  },
  'Title':'<your title here>'
}

 

Marty_88
New Member

Hi @shoog 

Marty_88_0-1653038408087.png

 

even with single quotes it has the same error...

shoog
Dual Super User
Dual Super User

Sorry for the late reply.

Please revert to the Content-Type header to verbose like in your original screenshot, right now it defaults to basic odata, which doesn't include the metadata tag.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (1,638)