mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 08:26:00 +02:00
[GH-ISSUE #1185] How to get the lastest message of a topic in JSON format from api? #835
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#835
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @winteris on GitHub (Sep 20, 2024).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/1185
❓ Question
I just got a file named
json.ndjsonwhen I start a http request in safari and other internet explorer whit this URL:ntfy.sh/stats/json?poll=1Exactly, I just want to get the lastest json string using a get http request in iOS shortcuts, but I can’t parse out the message.
Can I get a JSON string directly with the api?
https://docs.ntfy.sh/examples/
Examples in docs all are
sendand there is no agetexample , can someone give me some help?@wunter8 commented on GitHub (Sep 20, 2024):
You can't get only the latest message using the API right now if you haven't been listening to the topic and tracking message IDs.
/json?poll=1is going to be your best option. Then just truncate the response/only look at the last line of the response@winteris commented on GitHub (Sep 20, 2024):
Thank you for your reply.
I think I’ve followed the route you point out, but when I use
/json?poll=1to get all available messages, I got ajson.ndjsonfile instead of a json string or text as the reponse., and then, I can’t parse out the message from the.ndjsonfile, in iOS shortcuts APP.I think It will more useul if I got a
texttype of reponse instead of afileone. Could it possible? Or need a feature request to move it on?@winteris commented on GitHub (Sep 20, 2024):
Got it finally!
If I use
ntfy.sh/topic/raw?poll=1, I’ll get a response in atexttype.But I still wish the
/json?poll=1could support text response if it is possible.