Extract message examples to own file
This commit is contained in:
parent
11fda992b6
commit
f2c2688f0b
|
|
@ -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"}})
|
||||||
|
}
|
||||||
|
```
|
||||||
31
README.md
31
README.md
|
|
@ -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 |
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue