Hi, @ameyer24, you'll need to rely on the SitePages API for ease of use, here, I think.
Initial Starter For Ten
Just a little information to get you started ... if you are doing one, very specific thing, you may be able to keep things simple, but you'll see the complexity when you get to the HTML part of things.
Knowing the webpart ID that you want to update will probably be the key thing to know for most updates, too.
API Info
I've placed this in the spoiler as it is purely for reference:
Spoiler (Highlight to read)
There are two resources that I always find useful:
- Microsoft API References - These are the two main Microsoft pages for the SharePoint API
- SharePoint REST API Metadata Explorer - This is SUPER helpful with about 95-99 percent of all the endpoints there are to know about on there!
There is more buried on the Microsoft documentation site, in older versions, or for on-prem stuff ... but it's not the easiest resource.
There are two resources that I always find useful:
Microsoft API References - These are the two main Microsoft pages for the SharePoint API
Microsoft SharePoint API 1.0 - This is the main resource that you will have from MS
Microsoft SharePoint API 2.0 (graph) - This is useful to make your calls more modern and future proof as everything moves to the graph API
SharePoint REST API Metadata Explorer - This is SUPER helpful with about 95-99 percent of all the endpoints there are to know about on there!
There is more buried on the Microsoft documentation site, in older versions, or for on-prem stuff ... but it's not the easiest resource.
First Get The Page
Firstly, if you were (for example) to get the details of the home page, lets say you have a SharePoint HTTP action named:
Then you would want to select the site, set the 'Method' to GET, and then use something like this in the 'Uri' field:
_api/sitepages/Pages/GetById(1)
That would provide a JSON response, and the key value that you want is the 'CanvasContent1' value.
I can't remember if adding the following query helps things, so maybe also keep this in mind:
_api/sitepages/Pages/GetById(1)?env=Embedded
Then Convert CanvasContent1
However, that value is JSON but not kept in JSON format. So you will need an action after the HTTP action to decode that with:
json(body('HTTP_GET_PageJSON')?['d/CanvasContent1'])
I tend to use an Array type Variable for this.
Now Update Page
The final thing you will need to do to modify a page is to update it. This uses the same call as getting the page, and that just needs to be sent with the 'PATCH' method. Again, if you need the query, include it.
You probably don't need specific Accept and Content-type headers here, however if you do use verbose ODATA values for those, then you just need to include a metadata key and object for the body of this action.
Other Actions
You may need to check-in, check-out, etc, and other stuff with your page, or set the properties, or publishing status. Try to attack those parts separately in your head. Get the updating down first, and you'll get the rest easily enough.
Moving Forward
From here on out, I can't really guide you any more, as your question is a more broad question. Which is fine, just gives you some fun to have! 🙂
Raise Something Specific
If you already have a flow and a specific purpose, then perhaps raise a new question for what you specifically need to get accomplished that you cannot work out yourself. Don't edit this one, as it might get a little mired.
If you do, do try make sure to embed (not attach, not everyone can download files) some screenshots of the designer view of your flow into the question. This provides context that assists others recognise their problem in yours, and helpers to have more of an idea of how to help you.
If you are getting specific errors, then try to include imagery of the run results, too. Heck, if you have example data that could help folks ... even better! 😅
Remember that you can always obfuscate (blot out / blur / whatever) anything sensitive, so don't worry about that too much.
You may also be better off asking in a SharePoint community / online area, as they'll give you API specific help on this. You can just ignore all the permissions stuff, since you're doing it in Power Automate. 😉
Finally
Again, this is going to be advanced as you will want to ensure that you nail the HTML that you're pushing through, as Modern SharePoint Online is reasonably strict.
For example, I recently put together the following and this is just the Scope for deciding the content of a team people part when someone is added / removed from the group!
Another example; I used this method recently and needed to ensure that the Rich Text that people were entering in a list elsewhere was responsibly being displayed on the page in the fonts (etc) that are appropriate to that page. So I had to strip all customisations of the text beyond the basic heaviness or emphasis, therein. A *lot* of logic work.