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

Question about inconsistency in the tag(s) parameter for apprise-api #136

Closed ThorpeJosh closed 10 months ago

ThorpeJosh commented 10 months ago

:question: Question I have discovered an inconsistency with tags that tripped me up for 30min.

When you attempt to send a notification to apprise-api with a key of abc and with a specific tag of email it seems sometimes the parameter is tag and sometimes tags.

Using curl to send a notification via apprise-api is tag:

curl -X POST \
    -F "tag=email" \
    -F "body=Test Message" \
    "http://10.0.10.10:8000/notify/abc"

Using apprise cli to send a notification is --tag:

apprise -v --body="Test Message" \
   --tag=email

But using apprise cli to send a notification via apprise-api is tags:

apprise --body="Test Message" \
    apprise://10.0.10.10:8000/abc/?tags=email

If you use tag instead as per every other case and all the documentation, you get a 424 error with no hints or suggestion of what went wrong:

apprise -vv --body="Test Message" 'apprise://10.0.10.10:8000/abc/?tag=email'
2023-09-14 02:25:27,968 - WARNING - Failed to send Apprise API notification: error=424.

Also there is no example on the wiki showing how to send tags, which is one of the main advantages of using apprise-api with a config.

Was this inconsistency deliberate? Can it be changed or would that break too many deployments? Could we please add an example to the Notify_apprise_api wiki that shows the use of the tag functionality to help others?

ThorpeJosh commented 10 months ago

And also maybe a feature request...... Can we make it possible to support the cli --tag input with an apprise-api target?

For example allow adding tags:

apprise -vv --body="Test Message" --tag="email" apprise://10.0.10.10:8000/abc
2023-09-14 02:29:40,550 - WARNING - --tag (-g) entries are ignored when using specified URLs
2023-09-14 02:29:40,575 - WARNING - Failed to send Apprise API notification: error=424.
caronc commented 10 months ago

For the Apprise apprise:// plugin, tags are already supported. But the --tag is tied to the binary, you need to add the tag on your URL... so:

apprise -vv --body="Test Message" "apprise://10.0.10.10:8000/abc?tags=email"

I updated the Wiki to provide better examples for this as well.