mirror of
https://github.com/caronc/apprise-api.git
synced 2025-08-19 18:55:12 +02:00
Added syntax highlighting to (now completed) examples (#9)
This commit is contained in:
@@ -7,12 +7,21 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<!--Let browser know website is optimized for mobile-->
|
<!--Let browser know website is optimized for mobile-->
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<!--highlightjs-->
|
||||||
|
<link rel="stylesheet" href="{% static 'css/highlight.min.css' %}">
|
||||||
|
<!--materialize-->
|
||||||
<link rel="stylesheet" href="{% static 'css/materialize.min.css' %}" />
|
<link rel="stylesheet" href="{% static 'css/materialize.min.css' %}" />
|
||||||
|
<!--material-design-icons-->
|
||||||
<link rel="stylesheet" href="{% static 'iconfont/material-icons.css' %}">
|
<link rel="stylesheet" href="{% static 'iconfont/material-icons.css' %}">
|
||||||
|
<!--common-->
|
||||||
<link rel="stylesheet" href="{% static 'css/base.css' %}" />
|
<link rel="stylesheet" href="{% static 'css/base.css' %}" />
|
||||||
<link rel="shortcut icon" type="image/png" href="{% static 'favicon.ico' %}" />
|
<link rel="shortcut icon" type="image/png" href="{% static 'favicon.ico' %}" />
|
||||||
|
<!--materialize-->
|
||||||
<script src="{% static 'js/materialize.min.js' %}"></script>
|
<script src="{% static 'js/materialize.min.js' %}"></script>
|
||||||
|
<!--sweetalert2-->
|
||||||
<script src="{% static 'js/sweetalert2.all.min.js' %}"></script>
|
<script src="{% static 'js/sweetalert2.all.min.js' %}"></script>
|
||||||
|
<!--highlightjs-->
|
||||||
|
<script src="{% static 'js/highlight.pack.js' %}"></script>
|
||||||
<title>{% block title %}{% trans "Apprise API" %}{% endblock %}</title>
|
<title>{% block title %}{% trans "Apprise API" %}{% endblock %}</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -64,11 +73,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
// Materialize Init
|
||||||
M.AutoInit();
|
M.AutoInit();
|
||||||
|
// highlightjs
|
||||||
|
hljs.initHighlightingOnLoad();
|
||||||
{% block onload %} {% endblock %}
|
{% block onload %} {% endblock %}
|
||||||
});
|
});
|
||||||
{% block jsfooter %} {% endblock %}
|
{% block jsfooter %} {% endblock %}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@@ -29,7 +29,8 @@
|
|||||||
<div class="section">
|
<div class="section">
|
||||||
{% blocktrans %}For example, the following command would cause apprise to retrieve the configuration loaded and
|
{% blocktrans %}For example, the following command would cause apprise to retrieve the configuration loaded and
|
||||||
send a test notification to all of your added services:{% endblocktrans %}
|
send a test notification to all of your added services:{% endblocktrans %}
|
||||||
<br /><code>apprise --body="Test Message" --tag=all --config={{request.scheme}}://{{request.META.HTTP_HOST}}{% url "get" key %}</code>
|
<br /><pre><code class="bash">apprise --body="Test Message" --tag=all \<br/>
|
||||||
|
--config={{request.scheme}}://{{request.META.HTTP_HOST}}{% url "get" key %}</code></pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="config" class="col s12">
|
<div id="config" class="col s12">
|
||||||
|
@@ -7,19 +7,20 @@
|
|||||||
<a target="_blank" href="https://github.com/caronc/apprise">Apprise</a> allows you to send a notification to almost
|
<a target="_blank" href="https://github.com/caronc/apprise">Apprise</a> allows you to send a notification to almost
|
||||||
all of the most popular notification services available to us today such as: <em>Telegram</em>, <em>Discord</em>,
|
all of the most popular notification services available to us today such as: <em>Telegram</em>, <em>Discord</em>,
|
||||||
<em>Slack</em>, <em>Amazon SNS</em>, <em>Gotify</em>, etc.
|
<em>Slack</em>, <em>Amazon SNS</em>, <em>Gotify</em>, etc.
|
||||||
This API provides a simple gateway to directly access it via an HTTP interface.
|
This API provides a simple gateway to directly access it via an HTTP interface.{% endblocktrans %}
|
||||||
<ul>
|
<ul>
|
||||||
<li><i class="tiny material-icons">chevron_right</i>This project was designed to be incredibly light weight.</li>
|
<li><i class="tiny material-icons">chevron_right</i>{% blocktrans %}This project was designed to be incredibly light
|
||||||
<li><i class="tiny material-icons">chevron_right</i>Configuration can be persistently stored for retrieval.</li>
|
weight.{% endblocktrans %}</li>
|
||||||
|
<li><i class="tiny material-icons">chevron_right</i>{% blocktrans %}Configuration can be persistently stored for
|
||||||
|
retrieval.{% endblocktrans %}</li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endblocktrans %}
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<h4>{% trans "Endpoints" %}</h4>
|
<h4>{% trans "Stateless Endpoints" %}</h4>
|
||||||
<p>{% blocktrans %}All endpoints that expect posted data can be received in either JSON or in it's standard encoding.
|
<p>{% blocktrans %}Those who wish to treat this API as nothing but a <a
|
||||||
You must pass along the <code>Content-Type</code> as <code>application/json</code> in order for it to be interpreted
|
href="https://docs.microsoft.com/en-us/azure/architecture/patterns/sidecar" target="_blank">sidecar</a> and/or
|
||||||
properly.{% endblocktrans %}</p>
|
microservice to their project only need to use the following URL.{% endblocktrans %}</p>
|
||||||
<table class="highlighted">
|
<table class="highlighted">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -30,12 +31,11 @@
|
|||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>/add/<em>{% trans "KEY" %}</em></code></td>
|
<td><code>/notify/</code></td>
|
||||||
<td>
|
<td>
|
||||||
{% blocktrans %}Used to add a new Apprise configuration or a set of URLs and associates them with the
|
{% blocktrans %}Used to notify one one or more specified Apprise URLs. See the <a target="_blank"
|
||||||
specified <em>KEY</em>. See the <a target="_blank"
|
|
||||||
href="https://github.com/caronc/apprise/wiki#notification-services">Apprise Wiki</a> if you need help
|
href="https://github.com/caronc/apprise/wiki#notification-services">Apprise Wiki</a> if you need help
|
||||||
constructing your URLs.{% endblocktrans %}
|
constructing your URL(s).{% endblocktrans %}
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
@@ -51,27 +51,31 @@
|
|||||||
one URL from the next.{% endblocktrans %}</td>
|
one URL from the next.{% endblocktrans %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>config</td>
|
<td>body</td>
|
||||||
<td>{% blocktrans %}Provide the contents of either a YAML or TEXT based Apprise
|
<td>{% blocktrans %}Defines the message body. This field is required!{% endblocktrans %}</td>
|
||||||
configuration.{% endblocktrans %}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>format</td>
|
<td>title</td>
|
||||||
<td>{% blocktrans %}This field is only required if you've specified the config option. It's purpose is
|
<td>{% blocktrans %}The title to include in the notification. This is an optional
|
||||||
to tell the server which of the supported (Apprise) configuration types you are passing. Valid
|
field.{% endblocktrans %}
|
||||||
options are:{% endblocktrans %}
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>type</td>
|
||||||
|
<td>{% blocktrans %}This optional field defines the notification type. The possible options
|
||||||
|
are:{% endblocktrans %}
|
||||||
<ol>
|
<ol>
|
||||||
<li><code>{% trans "yaml" %}</code></li>
|
<li><i class="tiny material-icons" style="color: blue">info</i><code>{% trans "info" %}</code> -
|
||||||
<li><code>{% trans "text" %}</code></li>
|
<i>{% blocktrans %}this is the default option if a type
|
||||||
|
isn't
|
||||||
|
specified.{% endblocktrans %}</i></li>
|
||||||
|
<li><i class="tiny material-icons"
|
||||||
|
style="color: green">check_circle</i><code>{% trans "success" %}</code></li>
|
||||||
|
<li><i class="tiny material-icons"
|
||||||
|
style="color: orange">report_problem</i><code>{% trans "warning" %}</code></li>
|
||||||
|
<li><i class="tiny material-icons" style="color: red">cancel</i><code>{% trans "failure" %}</code>
|
||||||
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
<ul>
|
|
||||||
<li>{% blocktrans %}You must specify either the <code>urls</code> parameter or the
|
|
||||||
<code>config</code>.{% endblocktrans %}</li>
|
|
||||||
<li>{% blocktrans %}The <code>urls</code> takes priority over the <code>config</code> if both were
|
|
||||||
specified.{% endblocktrans %}</li>
|
|
||||||
<li>{% blocktrans %}The <code>format</code> parameter is only required if the <code>config</code>
|
|
||||||
parameter was also specified.{% endblocktrans %}</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -80,119 +84,415 @@
|
|||||||
<li>
|
<li>
|
||||||
<div class="collapsible-header"><i class="material-icons">code</i>curl example</div>
|
<div class="collapsible-header"><i class="material-icons">code</i>curl example</div>
|
||||||
<div class="collapsible-body">
|
<div class="collapsible-body">
|
||||||
<code>#
|
<pre><code class="bash">
|
||||||
{% blocktrans %}Load a single URL and assign it to the <em>KEY</em> of abc123{% endblocktrans %}<br/>
|
# {% blocktrans %}Notifies an email address{% endblocktrans %}<br/>
|
||||||
curl -X POST -d '{"urls":"mailto://user:pass@gmail.com"}' \<br/>
|
curl -X POST -d '{"urls":"mailto://user:pass@gmail.com","body":"test body","title":"test title"}' \<br/>
|
||||||
-H "Content-Type: application/json" \<br/>
|
-H "Content-Type: application/json" \<br/>
|
||||||
http://localhost:8000/add/<em>abc123</em></code>
|
http://localhost:8000/notify/</code></pre>
|
||||||
<code><br/>
|
|
||||||
<br/>#{% blocktrans %}Load a simple TEXT config entry <em>KEY</em> of abc123{% endblocktrans %}<br/>
|
|
||||||
curl -X POST -d '{"format":"text","config":"devops=mailto://user:pass@gmail.com"}' \<br/>
|
|
||||||
-H "Content-Type: application/json" \<br/>
|
|
||||||
http://localhost:8000/add/abc123/
|
|
||||||
</code>
|
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<div class="collapsible-header"><i class="material-icons">code</i>python example</div>
|
<div class="collapsible-header"><i class="material-icons">code</i>python example</div>
|
||||||
<div class="collapsible-body"><code>Coming Soon</code></div>
|
<div class="collapsible-body">
|
||||||
<li>
|
<pre><code class="python">
|
||||||
|
import json<br/>
|
||||||
|
from urllib.request import Request<br/>
|
||||||
|
<br/>
|
||||||
|
payload = {<br/>
|
||||||
|
'urls': 'mailto://user:pass@gmail.com',<br/>
|
||||||
|
'title': 'test title',<br/>
|
||||||
|
'body': 'test body',<br/>
|
||||||
|
}<br/>
|
||||||
|
<br/># The URL<br/>
|
||||||
|
req = Request(<br/>
|
||||||
|
"http://localhost:8000/notify/",<br/>
|
||||||
|
json.dumps(payload).encode('utf-8'),<br/>
|
||||||
|
{"Content-Type": "application/json"},<br/>
|
||||||
|
method='POST',<br/>
|
||||||
|
)
|
||||||
|
</code></pre>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<div class="collapsible-header"><i class="material-icons">code</i>php example</div>
|
<div class="collapsible-header"><i class="material-icons">code</i>php example</div>
|
||||||
<div class="collapsible-body"><code>Coming Soon</code></div>
|
<div class="collapsible-body">
|
||||||
|
<pre><code class="php"><?php<br/>
|
||||||
|
<br/>
|
||||||
|
// The URL<br/>
|
||||||
|
$url = 'http://localhost:8000/notify/';<br/>
|
||||||
|
<br/>
|
||||||
|
//Initiate cURL.<br/>
|
||||||
|
$ch = curl_init($url);<br/>
|
||||||
|
<br/>
|
||||||
|
//The JSON data.<br/>
|
||||||
|
$jsonData = array(<br/>
|
||||||
|
'urls' => 'mailto://user:pass@hotmail.com',<br/>
|
||||||
|
'title' => 'test title',<br/>
|
||||||
|
'body' => 'test body'<br/>
|
||||||
|
);<br/>
|
||||||
|
<br/>
|
||||||
|
//Encode the array into JSON.<br/>
|
||||||
|
$jsonDataEncoded = json_encode($jsonData);<br/>
|
||||||
|
<br/>
|
||||||
|
//Tell cURL that we want to send a POST request.<br/>
|
||||||
|
curl_setopt($ch, CURLOPT_POST, 1);<br/>
|
||||||
|
<br/>
|
||||||
|
//Attach our encoded JSON string to the POST fields.<br/>
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);<br/>
|
||||||
|
<br/>
|
||||||
|
//Set the content type to application/json<br/>
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));<br/>
|
||||||
|
<br/>
|
||||||
|
//Execute the request<br/>
|
||||||
|
$result = curl_exec($ch);
|
||||||
|
</code></pre>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
</tbody>
|
||||||
<td><code>/del/<em>{% trans "KEY" %}</em></code></td>
|
</table>
|
||||||
<td>{% blocktrans %}There are no arguments required. If the <em>KEY</em> exists and has data associated with it,
|
|
||||||
it will be removed.{% endblocktrans %}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><code>/get/<em>{% trans "KEY" %}</em></code></td>
|
|
||||||
<td>{% blocktrans %}This feature can be used by Apprise itself. It provides a means of remotely fetching it's
|
|
||||||
configuration.{% endblocktrans %}
|
|
||||||
|
|
||||||
<p><strong>{% trans "As an example:" %}</strong><br /><code>apprise --body="test message" --config={{ request.scheme }}://{{request.META.HTTP_HOST}}{{ request.path }}<em>{% trans "KEY" %}</em></p>
|
<div class="section">
|
||||||
<ul class="collapsible">
|
<h4>{% trans "Persistent Store Endpoints" %}</h4>
|
||||||
|
<p>{% blocktrans %}Those wishing to use the persistent store may do so. This section is a set it and forget it type
|
||||||
|
deal. Set your configuration once and just trigger notifications later on demand with light-weight API
|
||||||
|
calls.{% endblocktrans %}</p>
|
||||||
|
<p>{% blocktrans %}All endpoints that expect posted data can be received in either JSON or in it's standard
|
||||||
|
encoding.
|
||||||
|
You must pass along the <code>Content-Type</code> as <code>application/json</code> in order for it to be
|
||||||
|
interpreted
|
||||||
|
properly.{% endblocktrans %}</p>
|
||||||
|
|
||||||
|
<table class="highlighted">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{% trans "URL" %}</th>
|
||||||
|
<th>{% trans "Description" %}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td><code>/add/<em>{% trans "KEY" %}</em></code></td>
|
||||||
|
<td>
|
||||||
|
{% blocktrans %}Used to add a new Apprise configuration or a set of URLs and associates them with the
|
||||||
|
specified <em>KEY</em>. See the <a target="_blank"
|
||||||
|
href="https://github.com/caronc/apprise/wiki#notification-services">Apprise Wiki</a> if you need help
|
||||||
|
constructing your URLs.{% endblocktrans %}
|
||||||
|
<div class="section">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{% trans "Parameter" %}</th>
|
||||||
|
<th>{% trans "Description" %}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>urls</td>
|
||||||
|
<td>{% blocktrans %}Used to define one or more Apprise URL(s). Use a comma and/or space to separate
|
||||||
|
one URL from the next.{% endblocktrans %}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>config</td>
|
||||||
|
<td>{% blocktrans %}Provide the contents of either a YAML or TEXT based Apprise
|
||||||
|
configuration.{% endblocktrans %}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>format</td>
|
||||||
|
<td>{% blocktrans %}This field is only required if you've specified the config option. It's purpose
|
||||||
|
is
|
||||||
|
to tell the server which of the supported (Apprise) configuration types you are passing. Valid
|
||||||
|
options are:{% endblocktrans %}
|
||||||
|
<ol>
|
||||||
|
<li><code>{% trans "yaml" %}</code></li>
|
||||||
|
<li><code>{% trans "text" %}</code></li>
|
||||||
|
</ol>
|
||||||
|
<ul>
|
||||||
|
<li>{% blocktrans %}You must specify either the <code>urls</code> parameter or the
|
||||||
|
<code>config</code>.{% endblocktrans %}</li>
|
||||||
|
<li>{% blocktrans %}The <code>urls</code> takes priority over the <code>config</code> if both
|
||||||
|
were
|
||||||
|
specified.{% endblocktrans %}</li>
|
||||||
|
<li>{% blocktrans %}The <code>format</code> parameter is only required if the
|
||||||
|
<code>config</code>
|
||||||
|
parameter was also specified.{% endblocktrans %}</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<ul class="collapsible">
|
||||||
|
<li>
|
||||||
|
<div class="collapsible-header"><i class="material-icons">code</i>curl example</div>
|
||||||
|
<div class="collapsible-body">
|
||||||
|
<pre><code class="bash">
|
||||||
|
# {% blocktrans %}Load a single URL and assign it to the <em>KEY</em> of abc123{% endblocktrans %}<br/>
|
||||||
|
curl -X POST -d '{"urls":"mailto://user:pass@gmail.com"}' \<br/>
|
||||||
|
-H "Content-Type: application/json" \<br/>
|
||||||
|
http://localhost:8000/add/<em>abc123</em></code></pre>
|
||||||
|
<pre><code class="bash">
|
||||||
|
# {% blocktrans %}Load a simple TEXT config entry <em>KEY</em> abc123{% endblocktrans %}<br/>
|
||||||
|
curl -X POST -d '{"format":"text","config":"devops=mailto://user:pass@gmail.com"}' \<br/>
|
||||||
|
-H "Content-Type: application/json" \<br/>
|
||||||
|
http://localhost:8000/add/abc123/
|
||||||
|
</code></pre>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<div class="collapsible-header"><i class="material-icons">code</i>python example</div>
|
||||||
|
<div class="collapsible-body">
|
||||||
|
<pre><code class="python">
|
||||||
|
import json<br/>
|
||||||
|
from urllib.request import Request<br/>
|
||||||
|
<br/>
|
||||||
|
payload = {<br/>
|
||||||
|
'urls': 'mailto://user:pass@gmail.com',<br/>
|
||||||
|
}<br/>
|
||||||
|
<br/># The URL if the key was <em>abc123</em><br/>
|
||||||
|
req = Request(<br/>
|
||||||
|
"http://localhost:8000/add/<em>abc123</em>",<br/>
|
||||||
|
json.dumps(payload).encode('utf-8'),<br/>
|
||||||
|
{"Content-Type": "application/json"},<br/>
|
||||||
|
method='POST',<br/>
|
||||||
|
)
|
||||||
|
</code></pre>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<div class="collapsible-header"><i class="material-icons">code</i>php example</div>
|
||||||
|
<div class="collapsible-body">
|
||||||
|
<pre><code class="php"><?php<br/>
|
||||||
|
<br/>
|
||||||
|
// The URL if the key was <em>abc123</em><br/>
|
||||||
|
$url = 'http://localhost:8000/add/<em>abc123</em>';<br/>
|
||||||
|
<br/>
|
||||||
|
//Initiate cURL.<br/>
|
||||||
|
$ch = curl_init($url);<br/>
|
||||||
|
<br/>
|
||||||
|
//The JSON data.<br/>
|
||||||
|
$jsonData = array(<br/>
|
||||||
|
'urls' => 'mailto://user:pass@hotmail.com'<br/>
|
||||||
|
);<br/>
|
||||||
|
<br/>
|
||||||
|
//Encode the array into JSON.<br/>
|
||||||
|
$jsonDataEncoded = json_encode($jsonData);<br/>
|
||||||
|
<br/>
|
||||||
|
//Tell cURL that we want to send a POST request.<br/>
|
||||||
|
curl_setopt($ch, CURLOPT_POST, 1);<br/>
|
||||||
|
<br/>
|
||||||
|
//Attach our encoded JSON string to the POST fields.<br/>
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);<br/>
|
||||||
|
<br/>
|
||||||
|
//Set the content type to application/json<br/>
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));<br/>
|
||||||
|
<br/>
|
||||||
|
//Execute the request<br/>
|
||||||
|
$result = curl_exec($ch);
|
||||||
|
</code></pre>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>/del/<em>{% trans "KEY" %}</em></code></td>
|
||||||
|
<td>{% blocktrans %}There are no arguments required. If the <em>KEY</em> exists and has data associated with
|
||||||
|
it,
|
||||||
|
it will be removed.{% endblocktrans %}
|
||||||
|
<ul class="collapsible">
|
||||||
<li>
|
<li>
|
||||||
<div class="collapsible-header"><i class="material-icons">code</i>curl example</div>
|
<div class="collapsible-header"><i class="material-icons">code</i>curl example</div>
|
||||||
<div class="collapsible-body"><code>
|
<div class="collapsible-body">
|
||||||
# {% blocktrans %}Load a single URL and assign it to the <em>KEY</em> of abc123{% endblocktrans %}</br>
|
<pre><code class="bash">
|
||||||
curl -X POST -H "Content-Type: application/json" \<br/>
|
# {% blocktrans %}Remove previously loaded configuration associated with the <em>KEY</em> of abc123{% endblocktrans %}<br/>
|
||||||
http://localhost:8000/get/<em>abc123</em></code>
|
curl -X POST http://localhost:8000/del/<em>abc123</em></code></pre>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<div class="collapsible-header"><i class="material-icons">code</i>python example</div>
|
<div class="collapsible-header"><i class="material-icons">code</i>python example</div>
|
||||||
<div class="collapsible-body"><code>Coming Soon</code></div>
|
<div class="collapsible-body">
|
||||||
<li>
|
<pre><code class="python">
|
||||||
<li>
|
import json<br/>
|
||||||
<div class="collapsible-header"><i class="material-icons">code</i>php example</div>
|
from urllib.request import Request<br/>
|
||||||
<div class="collapsible-body"><code>Coming Soon</code></div>
|
<br/># The request if the key was <em>abc123</em><br/>
|
||||||
</li>
|
req = Request(<br/>
|
||||||
</ul>
|
"http://localhost:8000/del/<em>abc123</em>",<br/>
|
||||||
</td>
|
json.dumps(payload).encode('utf-8'),<br/>
|
||||||
</tr>
|
{"Content-Type": "application/json"},<br/>
|
||||||
<tr>
|
method='POST',<br/>
|
||||||
<td><code>/notify/<em>{% trans "KEY" %}</em></code></td>
|
)
|
||||||
<td>{% blocktrans %}Notifies the URLs associated with the specified <em>KEY</em>.{% endblocktrans %}
|
</code></pre>
|
||||||
<div class="section">
|
</div>
|
||||||
<table>
|
<li>
|
||||||
<thead>
|
<li>
|
||||||
<tr>
|
<div class="collapsible-header"><i class="material-icons">code</i>php example</div>
|
||||||
<th>{% trans "Parameter" %}</th>
|
<div class="collapsible-body">
|
||||||
<th>{% trans "Description" %}</th>
|
<pre><code class="php"><?php<br/>
|
||||||
</tr>
|
<br/>
|
||||||
</thead>
|
// The URL if the key was <em>abc123</em><br/>
|
||||||
<tbody>
|
$url = 'http://localhost:8000/del/<em>abc123</em>';<br/>
|
||||||
<tr>
|
<br/>
|
||||||
<td>body</td>
|
//Initiate cURL.<br/>
|
||||||
<td>{% blocktrans %}Defines the message body. This field is required!{% endblocktrans %}</td>
|
$ch = curl_init($url);<br/>
|
||||||
</tr>
|
<br/>
|
||||||
<tr>
|
//Tell cURL that we want to send a POST request.<br/>
|
||||||
<td>title</td>
|
curl_setopt($ch, CURLOPT_POST, 1);<br/>
|
||||||
<td>{% blocktrans %}The title to include in the notification. This is an optional field.{% endblocktrans %}
|
<br/>
|
||||||
</td>
|
//Execute the request<br/>
|
||||||
</tr>
|
$result = curl_exec($ch);
|
||||||
<tr>
|
</code></pre>
|
||||||
<td>type</td>
|
</div>
|
||||||
<td>{% blocktrans %}This optional field defines the notification type. The possible options
|
</li>
|
||||||
are:{% endblocktrans %}
|
</ul>
|
||||||
<ol>
|
</td>
|
||||||
<li><code>{% trans "info" %}</code> - <i>{% blocktrans %}this is the default option if a type isn't
|
</tr>
|
||||||
specified.{% endblocktrans %}</i></li>
|
<tr>
|
||||||
<li><code>{% trans "success" %}</code></li>
|
<td><code>/get/<em>{% trans "KEY" %}</em></code></td>
|
||||||
<li><code>{% trans "warning" %}</code></li>
|
<td>{% blocktrans %}This feature can be used by Apprise itself. It provides a means of remotely fetching it's
|
||||||
<li><code>{% trans "failure" %}</code></li>
|
configuration.{% endblocktrans %}<br />
|
||||||
</ol>
|
<pre><code lang="bash"># Use Apprise to retrieve your configuration:<br/>
|
||||||
</td>
|
apprise --body="test message" --config={{ request.scheme }}://{{request.META.HTTP_HOST}}{{ request.path }}<em>{% trans "KEY" %}</em></code></pre>
|
||||||
<tr>
|
</p>
|
||||||
<td>tags</td>
|
</td>
|
||||||
<td>{% blocktrans %}Apply tagging logic to the further filter your URLs. This is an optional
|
</tr>
|
||||||
field.{% endblocktrans %}</td>
|
<tr>
|
||||||
</tr>
|
<td><code>/notify/<em>{% trans "KEY" %}</em></code></td>
|
||||||
</tbody>
|
<td>{% blocktrans %}Notifies the URLs associated with the specified <em>KEY</em>.{% endblocktrans %}
|
||||||
</table>
|
<div class="section">
|
||||||
</div>
|
<table>
|
||||||
</td>
|
<thead>
|
||||||
</tr>
|
<tr>
|
||||||
</tbody>
|
<th>{% trans "Parameter" %}</th>
|
||||||
</table>
|
<th>{% trans "Description" %}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>body</td>
|
||||||
|
<td>{% blocktrans %}Defines the message body. This field is required!{% endblocktrans %}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>title</td>
|
||||||
|
<td>{% blocktrans %}The title to include in the notification. This is an optional
|
||||||
|
field.{% endblocktrans %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>type</td>
|
||||||
|
<td>{% blocktrans %}This optional field defines the notification type. The possible options
|
||||||
|
are:{% endblocktrans %}
|
||||||
|
<ol>
|
||||||
|
<li><i class="tiny material-icons" style="color: blue">info</i><code>{% trans "info" %}</code> -
|
||||||
|
<i>{% blocktrans %}this is the default option if a type
|
||||||
|
isn't
|
||||||
|
specified.{% endblocktrans %}</i></li>
|
||||||
|
<li><i class="tiny material-icons"
|
||||||
|
style="color: green">check_circle</i><code>{% trans "success" %}</code></li>
|
||||||
|
<li><i class="tiny material-icons"
|
||||||
|
style="color: orange">report_problem</i><code>{% trans "warning" %}</code></li>
|
||||||
|
<li><i class="tiny material-icons"
|
||||||
|
style="color: red">cancel</i><code>{% trans "failure" %}</code></li>
|
||||||
|
</ol>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>tags</td>
|
||||||
|
<td>{% blocktrans %}Apply tagging logic to the further filter your URLs. This is an optional
|
||||||
|
field.{% endblocktrans %}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<ul class="collapsible">
|
||||||
|
<li>
|
||||||
|
<div class="collapsible-header"><i class="material-icons">code</i>curl example</div>
|
||||||
|
<div class="collapsible-body">
|
||||||
|
<pre><code class="bash">
|
||||||
|
# {% blocktrans %}Notifies all URLs assigned the <em>devops</em> tag{% endblocktrans %}<br/>
|
||||||
|
curl -X POST -d '{"tags":"devops","body":"test body","title":"test title"}' \<br/>
|
||||||
|
-H "Content-Type: application/json" \<br/>
|
||||||
|
http://localhost:8000/notify/<em>KEY</em></code></pre>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<div class="collapsible-header"><i class="material-icons">code</i>python example</div>
|
||||||
|
<div class="collapsible-body">
|
||||||
|
<pre><code class="python">
|
||||||
|
import json<br/>
|
||||||
|
from urllib.request import Request<br/>
|
||||||
|
<br/>
|
||||||
|
payload = {<br/>
|
||||||
|
'tags': 'devops',<br/>
|
||||||
|
'title': 'test title',<br/>
|
||||||
|
'body': 'test body',<br/>
|
||||||
|
}<br/>
|
||||||
|
<br/># The URL if the key was <em>abc123</em><br/>
|
||||||
|
req = Request(<br/>
|
||||||
|
"http://localhost:8000/notify/<em>abc123</em>",<br/>
|
||||||
|
json.dumps(payload).encode('utf-8'),<br/>
|
||||||
|
{"Content-Type": "application/json"},<br/>
|
||||||
|
method='POST',<br/>
|
||||||
|
)
|
||||||
|
</code></pre>
|
||||||
|
</div>
|
||||||
|
<li>
|
||||||
|
<li>
|
||||||
|
<div class="collapsible-header"><i class="material-icons">code</i>php example</div>
|
||||||
|
<div class="collapsible-body">
|
||||||
|
<pre><code class="php"><?php<br/>
|
||||||
|
<br/>
|
||||||
|
// The URL if the key was <em>abc123</em><br/>
|
||||||
|
$url = 'http://localhost:8000/notify/<em>abc123</em>';<br/>
|
||||||
|
<br/>
|
||||||
|
//Initiate cURL.<br/>
|
||||||
|
$ch = curl_init($url);<br/>
|
||||||
|
<br/>
|
||||||
|
//The JSON data.<br/>
|
||||||
|
$jsonData = array(<br/>
|
||||||
|
'tags' => 'devops',<br/>
|
||||||
|
'title' => 'test title',<br/>
|
||||||
|
'body' => 'test body'<br/>
|
||||||
|
);<br/>
|
||||||
|
<br/>
|
||||||
|
//Encode the array into JSON.<br/>
|
||||||
|
$jsonDataEncoded = json_encode($jsonData);<br/>
|
||||||
|
<br/>
|
||||||
|
//Tell cURL that we want to send a POST request.<br/>
|
||||||
|
curl_setopt($ch, CURLOPT_POST, 1);<br/>
|
||||||
|
<br/>
|
||||||
|
//Attach our encoded JSON string to the POST fields.<br/>
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);<br/>
|
||||||
|
<br/>
|
||||||
|
//Set the content type to application/json<br/>
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));<br/>
|
||||||
|
<br/>
|
||||||
|
//Execute the request<br/>
|
||||||
|
$result = curl_exec($ch);
|
||||||
|
</code></pre>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<h5>{% trans "Endpoint Notes" %}</h5>
|
<h4>{% trans "Endpoint Notes" %}</h4>
|
||||||
<p>
|
<p>
|
||||||
The <em>KEY</em> you plan to associate your configuration with:
|
The <em>KEY</em> you plan to associate your configuration with:
|
||||||
<ol>
|
<ol>
|
||||||
<li>Can not have spaces and/or special characters in it. Both a dash (<code>-</code>) and underscore
|
<li>Can not have spaces and/or special characters in it. Both a dash (<code>-</code>) and underscore
|
||||||
(<code>_</code>) are the only exceptions to this rule.</li>
|
(<code>_</code>) are the only exceptions to this rule.</li>
|
||||||
<li>Must start with at least 2 alpha/numeric characters.</li>
|
<li>Must start with at least 2 alpha/numeric characters.</li>
|
||||||
<li>Can not exceed 64 characters in total length.</li>
|
<li>Can not exceed 64 characters in total length.</li>
|
||||||
</ol>
|
</ol>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
2
apprise_api/static/css/highlight.min.css
vendored
Normal file
2
apprise_api/static/css/highlight.min.css
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/* GitHub highlight.js style (c) Ivan Sagalaev <maniac@softwaremaniacs.org> */
|
||||||
|
.hljs{display:block;overflow-x:auto;padding:.5em;color:#333;background:#f8f8f8}.hljs-comment,.hljs-quote{color:#998;font-style:italic}.hljs-keyword,.hljs-selector-tag,.hljs-subst{color:#333;font-weight:700}.hljs-literal,.hljs-number,.hljs-tag .hljs-attr,.hljs-template-variable,.hljs-variable{color:teal}.hljs-doctag,.hljs-string{color:#d14}.hljs-section,.hljs-selector-id,.hljs-title{color:#900;font-weight:700}.hljs-subst{font-weight:400}.hljs-class .hljs-title,.hljs-type{color:#458;font-weight:700}.hljs-attribute,.hljs-name,.hljs-tag{color:navy;font-weight:400}.hljs-link,.hljs-regexp{color:#009926}.hljs-bullet,.hljs-symbol{color:#990073}.hljs-built_in,.hljs-builtin-name{color:#0086b3}.hljs-meta{color:#999;font-weight:700}.hljs-deletion{background:#fdd}.hljs-addition{background:#dfd}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}
|
2
apprise_api/static/js/highlight.pack.js
Normal file
2
apprise_api/static/js/highlight.pack.js
Normal file
File diff suppressed because one or more lines are too long
12374
apprise_api/static/js/materialize.js
vendored
12374
apprise_api/static/js/materialize.js
vendored
File diff suppressed because it is too large
Load Diff
29
apprise_api/static/licenses/highlight-9.17.1.LICENSE
Normal file
29
apprise_api/static/licenses/highlight-9.17.1.LICENSE
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
BSD 3-Clause License
|
||||||
|
|
||||||
|
Copyright (c) 2006, Ivan Sagalaev.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the name of the copyright holder nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
Reference in New Issue
Block a user