-
-
Notifications
You must be signed in to change notification settings - Fork 773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow all parameters for publishing in JSON body (including topic) #133
Comments
I think the feature is sound and easy to implement, though I don't quite know what the API would look like. If there is a universal topic as you say it's easy, but if you want to also publish to the individual topics it's kinda tricky. Here are a few options: Request body is assumed to be a JSON request with a well-formed message. Options for endpoint names: Option 1a:
Option 1b:
Option 1c:
Option 1d:
Option 1e:
Option 1f (topic in the body JSON):
|
I think option 1f (universal endpoint) is the only one I truly like, since it's short and doesn't need a super weird parameter to identify that the body is a JSON message blob. It is kinda tricky to implement though I think. |
Yeah, 1f would be my favourite, too....
Am 15. März 2022, 20:26, um 20:26, "Philipp C. Heckel" ***@***.***> schrieb:
…I think option 1f (universal endpoint) is the only one I truly like,
since it's short and doesn't need a super weird parameter to identify
that the body is a JSON message blob.
--
Reply to this email directly or view it on GitHub:
#133 (comment)
You are receiving this because you authored the thread.
Message ID: ***@***.***>
|
This is done and will be released with the next server release |
A generic way to publish via POST with JSON body (parameters like in URL parameters and HTTP headers) would be fantastic
As @binwiederhier wrote somewhere else something like this:
Regarding the question "That's not a bad idea, though I'm not sure I see the benefit over the other publishing methods.":
The concrete use case is an access control system (like in "smart door lock") that has webhooks, but doesn't allow for parameters in the URL. So if I want to post to different topics using a variable there (indicating the door opened for example), I can only do this in the request body.
Right now I solved it by routing the notification from the access control system over a NodeRED instance, which is relaying it to ntfy after massaging body and header to fit.
I hope that's a clear enough usage case. If it's not too hard to implement, this would make sending notifications via ntfy even more versatile. I suppose there would have to be a kind of "universal topic" to post this to, like "ntfy.sh/publish", "ntfy.sh/api/publish" or the like.
The text was updated successfully, but these errors were encountered: