From f2c2688f0b5e6a816bbcec768ca1c0de5af76b88 Mon Sep 17 00:00:00 2001 From: Jannis Mattheis Date: Fri, 9 Nov 2018 17:12:28 +0100 Subject: [PATCH] Extract message examples to own file --- ADD_MESSAGE_EXAMPLES.md | 32 ++++++++++++++++++++++++++++++++ README.md | 31 +++---------------------------- 2 files changed, 35 insertions(+), 28 deletions(-) create mode 100644 ADD_MESSAGE_EXAMPLES.md diff --git a/ADD_MESSAGE_EXAMPLES.md b/ADD_MESSAGE_EXAMPLES.md new file mode 100644 index 0000000..e53f05a --- /dev/null +++ b/ADD_MESSAGE_EXAMPLES.md @@ -0,0 +1,32 @@ +# Add Message Examples + +You can obtain an application-token from the apps tab inside the UI or using the REST-API (`GET /application`). + +NOTE: Assuming Gotify is running on `http://localhost:8008`. + +### Python + +```python +import requests #pip install requests +resp = requests.post('http://localhost:8008/message?token=', json={ + "message": "Well hello there.", + "priority": 2, + "title": "This is my title" +}) +``` + +### Golang + +```go +package main + +import ( + "net/http" + "net/url" +) + +func main() { + http.PostForm("http://localhost:8008/message?", + url.Values{"message": {"My Message"}, "title": {"My Title"}}) +} +``` \ No newline at end of file diff --git a/README.md b/README.md index 0295628..683b4a3 100644 --- a/README.md +++ b/README.md @@ -101,41 +101,16 @@ GOTIFY_UPLOADEDIMAGESDIR=images ### Add Message Examples -You can obtain an application-token from the apps tab inside the UI or using the REST-API (`GET /application`) +You can obtain an application-token from the apps tab inside the UI or using the REST-API (`GET /application`). NOTE: Assuming Gotify is running on `http://localhost:8008`. **curl** ```bash - curl -X POST "http://localhost:8008/message?token=" -F "title=My Title" -F "message=This is my message" -``` - -**python** - -```python -import requests #pip install requests -resp = requests.post('http://localhost:8008/message?token=', json={ - "message": "Well hello there.", - "priority": 2, - "title": "This is my title" -}) -``` - -**golang** - -```go -package main - -import ( - "net/http" - "net/url" -) - -func main() { - http.PostForm("http://localhost:8008/message?", url.Values{"message": {"My Message"}, "title": {"My Title"}}) -} +curl -X POST "http://localhost:8008/message?token=" -F "title=My Title" -F "message=This is my message" ``` +[More examples can be found here](ADD_MESSAGE_EXAMPLES.md) ### Database | Dialect | Connection |