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
Super User
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
Super User
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
Super User
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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (3,816)