Timeline for Updating link on page via REST api
Current License: CC BY-SA 4.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 29, 2019 at 9:19 | comment | added | memilanuk |
Finally got time to play with this tonight. Being able to extract the "content" as a string (rather than trying to manipulate nested dictionaries), update the specific URL using re.sub and then just upload that particular piece (rather than the whole payload) turns out to be way simpler than what I was trying to do before! Thanks!!!
|
|
Aug 29, 2019 at 9:16 | vote | accept | memilanuk | ||
Aug 27, 2019 at 2:49 | comment | added | Sally CJ |
As I said, you just need to update to "content" :) - that structured thing indicates an object (e.g. "content":{"rendered":"Foo bar"} ) which WordPress returns in the response when retrieving a Page/Post/etc. But when updating the resource, you'd use just "content":"New content here" . I.e. Send "content" as a string.
|
|
Aug 26, 2019 at 14:11 | comment | added | memilanuk | I had wondered about sending the whole payload back vs. just the specific field I'm concerned with. Good to know! One other question on sending the content back... when I retrieve it, it is in a structured/nested format, with "content" returning sub-levels of "rendered" and "protected". Do I need to just update to "content", or to "content": "rendered": "<h4>Foo</h4>"? | |
Aug 26, 2019 at 8:49 | history | answered | Sally CJ | CC BY-SA 4.0 |