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 |