caronc / apprise-api

A lightweight REST framework that wraps the Apprise Notification Library
https://hub.docker.com/r/caronc/apprise
MIT License
580 stars 50 forks source link

JSON API call to /notify/key fails #124

Closed npodbielski closed 1 year ago

npodbielski commented 1 year ago

:beetle: Describe the bug Calling API with JSON does not work at all. According to examples it should work:

POST https://apprise.example.com/notify/key
Content-Type: application/json

{
  "body": "test",
  "tag":"some tag"
}

This is really strange because much more complex Content-Type application/x-www-form-urlencoded works from curl, Python but does not work from .NET. The same is for multipart/form-data; works from curl but does not from .NET. Json content type does not work at all. And this is why I am creating this bug since I am bashing my head with this for whole day.

:bulb: Screenshots and Logs Returns: Response code: 424 (Failed Dependency); Time: 16ms (16 ms); Content length: 56 bytes (56 B)

Logs:

apprise  | 2023-07-13 05:11:52,680 [INFO] apprise: Loaded 1 entries from memory://
apprise  | 2023-07-13 05:11:52,682 [WARNING] django.request: Failed Dependency: /notify/key

:computer: Your System Details:

:crystal_ball: Additional context In an essence I want to connect shinobi motion detection notification to my matrix server via Apprise, but since Apprise does not allow webhooks - and Shinoby allows only those - I need to make a proxy. Thought about dotnet since I have it already set up, but no matter how I create a request it fails. There is not much in logs why this is happening - the only other way beside creating a bug here would be to debug apprise to find out what is happening.

npodbielski commented 1 year ago

Ok I did found the problem. I forgot to hit save on config page and tag I was using did not exists. So typical case of PEBKAC. Still I would expect API to throw 400 or 404 Tag do not exists. Instead of 424 that is defined for WebDav specifically I believe.