Added a few examples

* applied suggestions
This commit is contained in:
Ankur Srivastava 2018-11-07 21:51:01 +01:00 committed by Jannis Mattheis
parent 29e0857365
commit 11fda992b6
1 changed files with 42 additions and 3 deletions

View File

@ -8,6 +8,7 @@
* [Installation](#installation) * [Installation](#installation)
* [Configuration](#configuration) * [Configuration](#configuration)
* [Setup Dev Environment](#setup-dev-environment) * [Setup Dev Environment](#setup-dev-environment)
* [Add Message Examples](#add-message-examples)
* [Building](#building) * [Building](#building)
* [Tests](#tests) * [Tests](#tests)
* [Versioning](#versioning) * [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 * receiving messages per websocket
* user management * user management
* client/device & application 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 * Web-UI
<img alt="Gotify UI screenshot" src="ui.png" /> <img alt="Gotify UI screenshot" src="ui.png" />
* Android-App -> [gotify/android](https://github.com/gotify/android) * Android-App -> [gotify/android](https://github.com/gotify/android)
[<img src="https://play.google.com/intl/en_gb/badges/images/generic/en_badge_web_generic.png" alt="Get it on Google Play" width="150" />][playstore] [<img src="https://play.google.com/intl/en_gb/badges/images/generic/en_badge_web_generic.png" alt="Get it on Google Play" width="150" />][playstore]
[<img src="https://f-droid.org/badge/get-it-on.png" alt="Get it on F-Droid" width="150"/>][fdroid] [<img src="https://f-droid.org/badge/get-it-on.png" alt="Get it on F-Droid" width="150"/>][fdroid]
Google Play and the Google Play logo are trademarks of Google LLC. Google Play and the Google Play logo are trademarks of Google LLC.
@ -98,6 +99,44 @@ GOTIFY_PASSSTRENGTH=10
GOTIFY_UPLOADEDIMAGESDIR=images 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=<token-from-application>" -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=<token-from-application>', 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?<token-from-application>", url.Values{"message": {"My Message"}, "title": {"My Title"}})
}
```
### Database ### Database
| Dialect | Connection | | 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-normal]: https://hub.docker.com/r/gotify/server/
[docker-arm7]: https://hub.docker.com/r/gotify/server-arm7/ [docker-arm7]: https://hub.docker.com/r/gotify/server-arm7/
[playstore]: https://play.google.com/store/apps/details?id=com.github.gotify [playstore]: https://play.google.com/store/apps/details?id=com.github.gotify
[fdroid]: https://f-droid.org/de/packages/com.github.gotify/ [fdroid]: https://f-droid.org/de/packages/com.github.gotify/