Extract message examples to own file

This commit is contained in:
Jannis Mattheis 2018-11-09 17:12:28 +01:00
parent 11fda992b6
commit f2c2688f0b
2 changed files with 35 additions and 28 deletions

32
ADD_MESSAGE_EXAMPLES.md Normal file
View File

@ -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=<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"}})
}
```

View File

@ -101,41 +101,16 @@ GOTIFY_UPLOADEDIMAGESDIR=images
### Add Message Examples ### 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`. NOTE: Assuming Gotify is running on `http://localhost:8008`.
**curl** **curl**
```bash ```bash
curl -X POST "http://localhost:8008/message?token=<token-from-application>" -F "title=My Title" -F "message=This is my message" 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"}})
}
``` ```
[More examples can be found here](ADD_MESSAGE_EXAMPLES.md)
### Database ### Database
| Dialect | Connection | | Dialect | Connection |