2019-10-27 04:53:40 +01:00
|
|
|
{% extends 'base.html' %}
|
|
|
|
{% load i18n %}
|
2020-09-03 18:01:03 +02:00
|
|
|
|
2019-10-27 04:53:40 +01:00
|
|
|
{% block body %}
|
|
|
|
<h4>{% trans "The Apprise API" %}</h4>
|
|
|
|
<p>
|
|
|
|
{% blocktrans %}
|
|
|
|
<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>,
|
|
|
|
<em>Slack</em>, <em>Amazon SNS</em>, <em>Gotify</em>, etc.
|
2020-01-15 02:49:12 +01:00
|
|
|
This API provides a simple gateway to directly access it via an HTTP interface.{% endblocktrans %}
|
2019-10-27 04:53:40 +01:00
|
|
|
<ul>
|
2020-01-15 02:49:12 +01:00
|
|
|
<li><i class="tiny material-icons">chevron_right</i>{% blocktrans %}This project was designed to be incredibly light
|
|
|
|
weight.{% endblocktrans %}</li>
|
|
|
|
<li><i class="tiny material-icons">chevron_right</i>{% blocktrans %}Configuration can be persistently stored for
|
|
|
|
retrieval.{% endblocktrans %}</li>
|
2019-10-27 04:53:40 +01:00
|
|
|
</ul>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<div class="section">
|
2020-01-15 02:49:12 +01:00
|
|
|
<h4>{% trans "Stateless Endpoints" %}</h4>
|
|
|
|
<p>{% blocktrans %}Those who wish to treat this API as nothing but a <a
|
|
|
|
href="https://docs.microsoft.com/en-us/azure/architecture/patterns/sidecar" target="_blank">sidecar</a> and/or
|
|
|
|
microservice to their project only need to use the following URL.{% endblocktrans %}</p>
|
2019-10-27 04:53:40 +01:00
|
|
|
<table class="highlighted">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>{% trans "URL" %}</th>
|
|
|
|
<th>{% trans "Description" %}</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
2020-09-03 18:01:03 +02:00
|
|
|
<td><code>{{BASE_URL}}/notify/</code></td>
|
2019-10-27 04:53:40 +01:00
|
|
|
<td>
|
2020-01-15 02:49:12 +01:00
|
|
|
{% blocktrans %}Used to notify one one or more specified Apprise URLs. See the <a target="_blank"
|
2019-10-27 04:53:40 +01:00
|
|
|
href="https://github.com/caronc/apprise/wiki#notification-services">Apprise Wiki</a> if you need help
|
2020-01-15 02:49:12 +01:00
|
|
|
constructing your URL(s).{% endblocktrans %}
|
2019-10-27 04:53:40 +01:00
|
|
|
<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>
|
2020-01-15 02:49:12 +01:00
|
|
|
<td>body</td>
|
|
|
|
<td>{% blocktrans %}Defines the message body. This field is required!{% endblocktrans %}</td>
|
2019-10-27 04:53:40 +01:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2020-01-15 02:49:12 +01:00
|
|
|
<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 %}
|
2019-10-27 04:53:40 +01:00
|
|
|
<ol>
|
2020-01-15 02:49:12 +01:00
|
|
|
<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>
|
2019-10-27 04:53:40 +01:00
|
|
|
</ol>
|
|
|
|
</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">
|
2020-01-15 02:49:12 +01:00
|
|
|
<pre><code class="bash">
|
|
|
|
# {% blocktrans %}Notifies an email address{% endblocktrans %}<br/>
|
|
|
|
curl -X POST -d '{"urls":"mailto://user:pass@gmail.com","body":"test body","title":"test title"}' \<br/>
|
2019-10-27 04:53:40 +01:00
|
|
|
-H "Content-Type: application/json" \<br/>
|
2020-09-03 18:01:03 +02:00
|
|
|
{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/notify/</code></pre>
|
2019-10-27 04:53:40 +01:00
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<div class="collapsible-header"><i class="material-icons">code</i>python example</div>
|
2020-01-15 02:49:12 +01:00
|
|
|
<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/>
|
|
|
|
'title': 'test title',<br/>
|
|
|
|
'body': 'test body',<br/>
|
|
|
|
}<br/>
|
|
|
|
<br/># The URL<br/>
|
|
|
|
req = Request(<br/>
|
2020-09-03 18:01:03 +02:00
|
|
|
"{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/notify/",<br/>
|
2020-01-15 02:49:12 +01:00
|
|
|
json.dumps(payload).encode('utf-8'),<br/>
|
|
|
|
{"Content-Type": "application/json"},<br/>
|
|
|
|
method='POST',<br/>
|
|
|
|
)
|
|
|
|
</code></pre>
|
|
|
|
</div>
|
|
|
|
</li>
|
2019-10-27 04:53:40 +01:00
|
|
|
<li>
|
|
|
|
<div class="collapsible-header"><i class="material-icons">code</i>php example</div>
|
2020-01-15 02:49:12 +01:00
|
|
|
<div class="collapsible-body">
|
|
|
|
<pre><code class="php"><?php<br/>
|
|
|
|
<br/>
|
|
|
|
// The URL<br/>
|
2020-09-03 18:01:03 +02:00
|
|
|
$url = '{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/notify/';<br/>
|
2020-01-15 02:49:12 +01:00
|
|
|
<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>
|
2019-10-27 04:53:40 +01:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2020-01-15 02:49:12 +01:00
|
|
|
</tbody>
|
|
|
|
</table>
|
2019-10-27 04:53:40 +01:00
|
|
|
|
2020-09-03 18:01:03 +02:00
|
|
|
{% if STATEFUL_MODE != 'disabled' %}
|
2020-01-15 02:49:12 +01:00
|
|
|
<div class="section">
|
|
|
|
<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>
|
2020-09-03 18:01:03 +02:00
|
|
|
<td><code>{{BASE_URL}}/add/<em>{% trans "KEY" %}</em></code></td>
|
2020-01-15 02:49:12 +01:00
|
|
|
<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/>
|
2020-09-03 18:01:03 +02:00
|
|
|
{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/add/<em>abc123</em></code></pre>
|
2020-01-15 02:49:12 +01:00
|
|
|
<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/>
|
2020-09-03 18:01:03 +02:00
|
|
|
{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/add/abc123/
|
2020-01-15 02:49:12 +01:00
|
|
|
</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/>
|
2020-09-03 18:01:03 +02:00
|
|
|
"{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/add/<em>abc123</em>",<br/>
|
2020-01-15 02:49:12 +01:00
|
|
|
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/>
|
2020-09-03 18:01:03 +02:00
|
|
|
$url = '{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/add/<em>abc123</em>';<br/>
|
2020-01-15 02:49:12 +01:00
|
|
|
<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>
|
2020-09-03 18:01:03 +02:00
|
|
|
<td><code>{{BASE_URL}}/del/<em>{% trans "KEY" %}</em></code></td>
|
2020-01-15 02:49:12 +01:00
|
|
|
<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">
|
2019-10-27 04:53:40 +01:00
|
|
|
<li>
|
|
|
|
<div class="collapsible-header"><i class="material-icons">code</i>curl example</div>
|
2020-01-15 02:49:12 +01:00
|
|
|
<div class="collapsible-body">
|
|
|
|
<pre><code class="bash">
|
|
|
|
# {% blocktrans %}Remove previously loaded configuration associated with the <em>KEY</em> of abc123{% endblocktrans %}<br/>
|
2020-09-03 18:01:03 +02:00
|
|
|
curl -X POST {{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/del/<em>abc123</em></code></pre>
|
2020-01-15 02:49:12 +01:00
|
|
|
</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/># The request if the key was <em>abc123</em><br/>
|
|
|
|
req = Request(<br/>
|
2020-09-03 18:01:03 +02:00
|
|
|
"{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/del/<em>abc123</em>",<br/>
|
2020-01-15 02:49:12 +01:00
|
|
|
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/>
|
2020-09-03 18:01:03 +02:00
|
|
|
$url = '{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/del/<em>abc123</em>';<br/>
|
2020-01-15 02:49:12 +01:00
|
|
|
<br/>
|
|
|
|
//Initiate cURL.<br/>
|
|
|
|
$ch = curl_init($url);<br/>
|
|
|
|
<br/>
|
|
|
|
//Tell cURL that we want to send a POST request.<br/>
|
|
|
|
curl_setopt($ch, CURLOPT_POST, 1);<br/>
|
|
|
|
<br/>
|
|
|
|
//Execute the request<br/>
|
|
|
|
$result = curl_exec($ch);
|
|
|
|
</code></pre>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2020-09-03 18:01:03 +02:00
|
|
|
<td><code>{{BASE_URL}}/get/<em>{% trans "KEY" %}</em></code></td>
|
2020-01-15 02:49:12 +01:00
|
|
|
<td>{% blocktrans %}This feature can be used by Apprise itself. It provides a means of remotely fetching it's
|
|
|
|
configuration.{% endblocktrans %}<br />
|
|
|
|
<pre><code lang="bash"># Use Apprise to retrieve your configuration:<br/>
|
2020-09-03 18:01:03 +02:00
|
|
|
apprise --body="test message" --config={{ request.scheme }}://{{request.META.HTTP_HOST}}{{BASE_URL}}/get/<em>{% trans "KEY" %}</em></code></pre>
|
2020-01-15 02:49:12 +01:00
|
|
|
</p>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2020-09-03 18:01:03 +02:00
|
|
|
<td><code>{{BASE_URL}}/notify/<em>{% trans "KEY" %}</em></code></td>
|
2020-01-15 02:49:12 +01:00
|
|
|
<td>{% blocktrans %}Notifies the URLs associated with the specified <em>KEY</em>.{% endblocktrans %}
|
|
|
|
<div class="section">
|
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>{% trans "Parameter" %}</th>
|
|
|
|
<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>
|
2020-06-08 02:31:36 +02:00
|
|
|
<td>tag</td>
|
2020-01-15 02:49:12 +01:00
|
|
|
<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/>
|
2020-06-08 02:31:36 +02:00
|
|
|
curl -X POST -d '{"tag":"devops","body":"test body","title":"test title"}' \<br/>
|
2020-01-15 02:49:12 +01:00
|
|
|
-H "Content-Type: application/json" \<br/>
|
2020-09-03 18:01:03 +02:00
|
|
|
{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/notify/<em>KEY</em></code></pre>
|
2020-01-15 02:49:12 +01:00
|
|
|
</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/>
|
2020-06-08 02:31:36 +02:00
|
|
|
'tag': 'devops',<br/>
|
2020-01-15 02:49:12 +01:00
|
|
|
'title': 'test title',<br/>
|
|
|
|
'body': 'test body',<br/>
|
|
|
|
}<br/>
|
|
|
|
<br/># The URL if the key was <em>abc123</em><br/>
|
|
|
|
req = Request(<br/>
|
2020-09-03 18:01:03 +02:00
|
|
|
"{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/notify/<em>abc123</em>",<br/>
|
2020-01-15 02:49:12 +01:00
|
|
|
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/>
|
2020-09-03 18:01:03 +02:00
|
|
|
$url = '{{request.scheme}}://{{request.META.HTTP_HOST}}{{BASE_URL}}/notify/<em>abc123</em>';<br/>
|
2020-01-15 02:49:12 +01:00
|
|
|
<br/>
|
|
|
|
//Initiate cURL.<br/>
|
|
|
|
$ch = curl_init($url);<br/>
|
|
|
|
<br/>
|
|
|
|
//The JSON data.<br/>
|
|
|
|
$jsonData = array(<br/>
|
2020-06-08 02:31:36 +02:00
|
|
|
'tag' => 'devops',<br/>
|
2020-01-15 02:49:12 +01:00
|
|
|
'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>
|
|
|
|
|
2019-10-27 04:53:40 +01:00
|
|
|
<div class="section">
|
2020-01-15 02:49:12 +01:00
|
|
|
<h4>{% trans "Endpoint Notes" %}</h4>
|
|
|
|
<p>
|
|
|
|
The <em>KEY</em> you plan to associate your configuration with:
|
|
|
|
<ol>
|
|
|
|
<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>
|
|
|
|
<li>Must start with at least 2 alpha/numeric characters.</li>
|
|
|
|
<li>Can not exceed 64 characters in total length.</li>
|
|
|
|
</ol>
|
|
|
|
</p>
|
2019-10-27 04:53:40 +01:00
|
|
|
</div>
|
2020-01-15 02:49:12 +01:00
|
|
|
</div>
|
2020-09-03 18:01:03 +02:00
|
|
|
{% else %}
|
|
|
|
<div class="section">
|
|
|
|
<h4>{% trans "Persistent Store Endpoints" %}</h4>
|
|
|
|
<p>{% blocktrans %}The administrator of this system has disabled persistent storage.{% endblocktrans %}</p>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|