Well I was able to create new entries but couldnt find out how do UPDATE existing entries. The code above only creates new ones. Does anyone have a clue how to do that? And is it even possible to update singletons from frontend?
Ah, and is there a way to contribute to the documentation? Like help them creating better updated docs?
There is an error in @raffaelj’s, but otherwise is correct.
The php file singletonname.php should be in config/api/singletons/save/singletonname.php, which would then create an endpoint to save to Singleton “singletonname” at https://url.to/cockpit/api/singletons/save/singletonname?token=xxtokenxx
The API endpoint won’t work when not in api folder.
Equally, one could also put singletonname.php in config/api/singletonname.php and then POST data to https://url.to/cockpit/api/singletonname?token=xxtokenxx.
Hello there. I want to save singleton data via API, using only the API key without user credentials, but I can’t quite get this to work. When I POST a JSON body to my singleton save endpoint /api/singletons/save/prepared_spells?token=xyz (created as described in raffaelj’s answer) I get a response with code 302 Found but no body:
The header response Location: /auth/login?to=/api/singletons/save/prepared_spells makes me believe it wants a user auth, but I would like this particular singleton to be updateable without user credentials, with only an API token.
Any pointers on what I need to adjust to get this to work would be appreciated.