Skip to content

Commit

Permalink
Extract message examples to own file
Browse files Browse the repository at this point in the history
  • Loading branch information
jmattheis committed Nov 9, 2018
1 parent 11fda99 commit f2c2688
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 28 deletions.
32 changes: 32 additions & 0 deletions ADD_MESSAGE_EXAMPLES.md
@@ -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 changes: 3 additions & 28 deletions README.md
Expand Up @@ -101,41 +101,16 @@ 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`)
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"}})
}
curl -X POST "http://localhost:8008/message?token=<token-from-application>" -F "title=My Title" -F "message=This is my message"
```

[More examples can be found here](ADD_MESSAGE_EXAMPLES.md)

### Database
| Dialect | Connection |
Expand Down

0 comments on commit f2c2688

Please sign in to comment.