Jump to content

Restore trashed page from API


celfred
 Share

Recommended Posts

Hello,

I have a feeling I'm missing an easy thing here (again...). If I trash a page from API with :

mypage->trash()

Is there a simple way to restore it if needed ? I can do it in back-end, but I'd like to do it through API with something like

mypage->restore()

 but this doesn't exit :( 

So if you can give me a little help on that, I'd appreciate. Thanks in advance !

Link to comment
Share on other sites

As always in this community, a quick, straight to the point and perfect answer. Many thanks to you @kongondo

Sorry for missing it in the docs. I promise I searched for it but I was stuck in the $page part of the API and didn't see the restore()... My bad. Just to mention, I typed 'restore' in the search box (top left), but the API linked in your post above didn't appear in the results :( 

Anyway, the answer was quite simple (just as I thought, in the PW 'philosophy') and I'm happy with that. Thanks again !

Link to comment
Share on other sites

1 hour ago, celfred said:

Sorry for missing it in the docs. I promise I searched for it

There's no reason to feel sorry, we're a helpful bunch here :)

On a sidenote: you can try the "PW custom Google search engine" I've configured some time ago: https://cse.google.com/cse/publicurl?cx=013706179141317928628:dendm4c3gpq

pw-cse.thumb.png.e876e2ca34dd5f7c981e1144fb1df3fc.png

I have used the title of this forum thread ("Restore trashed page from API") and the first result in this very thread here, and the second one is the API reference page for trash - at the bottom you'll see "related" API links, one of them being "restore". I have bookmarked this custom search so I can simply type "PW", hit enter, and search across a variety of PW-sites/resources.

edit: kongondo was faster :-)

Edited by dragan
kongondo basically posted the same... minutes before
  • Like 4
  • Thanks 1
Link to comment
Share on other sites

1 hour ago, Juergen said:

Great! I didnt know that this exist :)

Yeah. I've had it in my signature for ages (so, you see, we are not so clever :P) . I can't remember who created this particular CSE though. I also have it bookmarked in my bookmarks bar for easy access.

 

  • Haha 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...