Skip to content

Commit

Permalink
Add static Hugo website and mkdocs documentation to docs directory.
Browse files Browse the repository at this point in the history
This commit merges the static website and docs that was on
https://github.com/knadh/listmonk-site repository into the main
listmonk repo.

It also adds a GitHub Actions workflow to public the sites on GitHub
Pages instead of Netlify.
  • Loading branch information
knadh committed Mar 25, 2023
1 parent 152bd37 commit d9e0f23
Show file tree
Hide file tree
Showing 69 changed files with 3,830 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/github-pages.yml
@@ -0,0 +1,55 @@
name: publish-github-pages

on:
push:
branches:
- docs
paths:
- 'docs/**'
workflow_dispatch:

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
submodules: true # Fetch Hugo themes
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod

- uses: actions/setup-python@v2
with:
python-version: 3.x
- run: pip install mkdocs-material

- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.68.3'

# Build the main site to the docs/publish directory. This will be the root (/) in gh-pages.
# The -d (output) path is relative to the -s (source) path
- name: Build main site
run: hugo -s docs/site -d ../publish --gc --minify

# Build the mkdocs documentation in the docs/publish/docs dir. This will be at (/docs)
# The -d (output) path is relative to the -f (source) path
- name: Build docs site
run: mkdocs build -f docs/docs/mkdocs.yml -d ../publish/docs

# Copy the static i18n app to the publish directory. This will be at (/i18n)
- name: Copy i18n site
run: cp -R docs/i18n docs/publish

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./docs/publish
cname: listmonk.app
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
56 changes: 56 additions & 0 deletions docs/docs/content/apis/apis.md
@@ -0,0 +1,56 @@
# APIs

All features that are available on the listmonk dashboard are also available as REST-like HTTP APIs that can be interacted with directly. Request and response bodies are JSON. This allows easy scripting of listmonk and integration with other systems, for instance, synchronisation with external subscriber databases.

API requests require BasicAuth authentication with the admin credentials.

!!! warning "Work in progress"

> The API section is a work in progress. There are a large number of API calls that are yet to be documented.
## Response structure

### Successful request

```http
HTTP/1.1 200 OK
Content-Type: application/json
{
"data": {}
}
```

All responses from the API server are JSON with the content-type application/json unless explicitly stated otherwise. A successful 200 OK response always has a JSON response body with a status key with the value success. The data key contains the full response payload.

### Failed request

```http
HTTP/1.1 500 Server error
Content-Type: application/json
{
"message": "Error message"
}
```

A failure response is preceded by the corresponding 40x or 50x HTTP header. There may be an optional `data` key with additional payload.

### Timestamps

All timestamp fields are in the format `2019-01-01T09:00:00.000000+05:30`. The seconds component is suffixed by the milliseconds, followed by the `+` and the timezone offset.

### Common HTTP error codes

| code |   |
| ----- | ------------------------------------------------------------------------ |
| `400` | Missing or bad request parameters or values |
| `403` | Session expired or invalidate. Must relogin |
| `404` | Request resource was not found |
| `405` | Request method (GET, POST etc.) is not allowed on the requested endpoint |
| `410` | The requested resource is gone permanently |
| `429` | Too many requests to the API (rate limiting) |
| `500` | Something unexpected went wrong |
| `502` | The backend OMS is down and the API is unable to communicate with it |
| `503` | Service unavailable; the API is down |
| `504` | Gateway timeout; the API is unreachable |

0 comments on commit d9e0f23

Please sign in to comment.