Using the RESTful API

Hello Everyone,

I have just started looking at Home Assistant and must say I am very impressed! This is probably a real Noob question but can someone please point me in the right direction?

I am running HA on a Pi4. I am trying to use the RESTful API to simply create an entry in the Log Book.

I have created my long lived access token and I am trying to use curl to test the API.

I am entering the following at the command prompt:
curl -X POST -H “Authorization: Bearer myverylongkeyhere”
-H “Content-Type: application/json” -d ‘{“message”: “Hello World”, “name”: “Test”}’ \ http://localhost:8123/api/logbook/log

I keep getting the response:
405: Method Not Allowed

What I am doing wrong?

If the docs are accurate, there is no POST method for the logbook endpoint, you can only GET log data.

Thanks for that.

So how would I go about adding an entry for something like ‘door open’ or ‘movement detected’?

See custom entries: https://www.home-assistant.io/integrations/logbook/#custom-entries

Thanks tom_l
Yes, that is what I want to do but I want to do it via curl and and the API
Is it not possible to do it via the API?