Update collection and singleton via api

If you want to save singleton data via api, just create a custom api endpoint in
config/api/singletons/save/singletonname.php with this content:

<?php

return $this->invoke('Singletons\\Controller\\Admin', 'update_data', ['singletonname']);

Now send a request:
https://url.to/cockpit/api/singletons/save/singletonname?token=xxtokenxx

json post body:
{"data":{"title":"test","content":"updated content"}}

Caution: It updates empty values, too. So you always have to send all fields or the other fields will be deleted.


edit: fixed wrong folder name of custom endpoint - Thanks @SimonHayden for the correction