Hello community,
I'm using https://processwire.com/modules/rest-api/ to define some REST API endpoints for my ProcessWire.
One of these endpoints receives an ID in the path via /api/foo/:id .
I search for the page using $pages->get() and can confirm that it's found.
The tricky part is now that when I do $my_page->trash() or $pages->trash($my_page) I end up with the following error:
"Attempt to read property "id" on null. File: [...]\wire\core\PagesEditor.php:296"
Which seems to be the case because ProcessWire checks with $this->wire("page")->id if the current page is the one I try to trash/delete.
Understandably there is no current page when this is not a template file.
So how could one proceed to trash/delete a page via REST API if the aforementioned ProcessWire APIs won't work?
Best regards
Tobias