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)
@ -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 |
| :-------: | :------------------------------------------------------------------: | | :-------: | :------------------------------------------------------------------: |