diff --git a/README.md b/README.md index 0a470f3..0295628 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ * [Installation](#installation) * [Configuration](#configuration) * [Setup Dev Environment](#setup-dev-environment) + * [Add Message Examples](#add-message-examples) * [Building](#building) * [Tests](#tests) * [Versioning](#versioning) @@ -22,13 +23,13 @@ We wanted a simple server for sending and receiving messages (in real time per w * receiving messages per websocket * user management * client/device & application management -* [REST-API Documentation][api-docs] (also available at `/docs`) +* [REST-API Documentation][api-docs] (also available at `/docs`) * Web-UI Gotify UI screenshot * Android-App -> [gotify/android](https://github.com/gotify/android) -[Get it on Google Play][playstore] +[Get it on Google Play][playstore] [Get it on F-Droid][fdroid] Google Play and the Google Play logo are trademarks of Google LLC. @@ -98,6 +99,44 @@ GOTIFY_PASSSTRENGTH=10 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`) + +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"}}) +} +``` + + ### Database | Dialect | Connection | | :-------: | :------------------------------------------------------------------: | @@ -176,4 +215,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file [docker-normal]: https://hub.docker.com/r/gotify/server/ [docker-arm7]: https://hub.docker.com/r/gotify/server-arm7/ [playstore]: https://play.google.com/store/apps/details?id=com.github.gotify - [fdroid]: https://f-droid.org/de/packages/com.github.gotify/ \ No newline at end of file + [fdroid]: https://f-droid.org/de/packages/com.github.gotify/