Merge commit '77cb1fb37c0da5bad39b3905f7a48cd3f176bac7' into api
This commit is contained in:
commit
c23f44d7b7
12
GUIDE.md
12
GUIDE.md
@ -211,15 +211,13 @@ Fortunately, Shynet offers a simple method you can call from anywhere within you
|
|||||||
|
|
||||||
### API
|
### API
|
||||||
|
|
||||||
All data displayed on dashboard can be obtained via API on url ```//shynet.example.com/api/dashboard/```.
|
All the information displayed on the dashboard can be obtained via API on url ```//shynet.example.com/api/dashboard/```. By default this endpoint will return the full data from all services over the last last 30 days. The `Authentication` header should be set to use user's parsonal API token (```'Authorization: Token <user API token>'```).
|
||||||
By default this url return full data from all services from last 30 days.
|
|
||||||
Authentication header should be set to use user's parsonal API token (```'Authorization:Token <user API token>'```).
|
|
||||||
|
|
||||||
There are 4 optional query parameters:
|
There are 4 optional query parameters:
|
||||||
* uuid - to get data only from one service
|
* `uuid` - to get data only from one service
|
||||||
* startDate - to set start date in format YYYY-MM-DD
|
* `startDate` - to set start date in format YYYY-MM-DD
|
||||||
* endDate - to set end date in format YYYY-MM-DD
|
* `endDate` - to set end date in format YYYY-MM-DD
|
||||||
* basic - to get only basic data set to '1' or 'true'
|
* `basic` - to get only basic data set to '1' or 'true'
|
||||||
|
|
||||||
Example in HTTPie:
|
Example in HTTPie:
|
||||||
```http get '//shynet.example.com/api/dashboard/?uuid={{service_uuid}}&startDate=2021-01-01&endDate=2050-01-01&basic=1' 'Authorization:Token {{user_api_token}}'```
|
```http get '//shynet.example.com/api/dashboard/?uuid={{service_uuid}}&startDate=2021-01-01&endDate=2050-01-01&basic=1' 'Authorization:Token {{user_api_token}}'```
|
||||||
|
@ -13,13 +13,14 @@
|
|||||||
</form>
|
</form>
|
||||||
<hr class="sep">
|
<hr class="sep">
|
||||||
<div>
|
<div>
|
||||||
<p class="label">Personal API token</p>
|
<p class="label mb-1">Personal API token</p>
|
||||||
<div class="flex justify-between">
|
<div class="flex justify-between">
|
||||||
<span class='chip ~info !normal'>{{request.user.api_token}}</span>
|
<span class='chip ~info !normal'>{{request.user.api_token}}</span>
|
||||||
<a class="href" href="{% url 'dashboard:api_token_refresh' %}">
|
<a class="href" href="{% url 'dashboard:api_token_refresh' %}">
|
||||||
<button type="submit" class="button ~warning !high">Refresh token</button>
|
<button type="submit" class="button ~neutral @high">Refresh token</button>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
<p class="support mt-1">To learn more about the API, see our <a href="https://github.com/milesmcc/shynet/blob/master/GUIDE.md#api">API guide</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -31,21 +31,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<hr class="sep h-4">
|
<hr class="sep h-4">
|
||||||
<div>
|
<h5>API</h5>
|
||||||
<h5>API</h5>
|
<div class="card ~neutral !low content">
|
||||||
<p>Service data can be accessed via API on url:</p>
|
<p>Shynet provides a simple API that you can use to pull data programmatically. You can access this data via this URL:</p>
|
||||||
<code>{{script_protocol}}{{request.get_host}}{% url 'api:services' %}?uuid={{object.uuid}}</code>
|
<code class="text-sm">{{script_protocol}}{{request.get_host}}{% url 'api:services' %}?uuid={{object.uuid}}</code>
|
||||||
<p>
|
<p>
|
||||||
There are 2 optional query parameters:
|
There are 2 optional query parameters:
|
||||||
<ul>
|
<ul>
|
||||||
<li>startDate - to set start date in format YYYY-MM-DD</li>
|
<li><code class="text-sm">startDate</code> — to set the start date (in format YYYY-MM-DD)</li>
|
||||||
<li>endDate - to set end date in format YYYY-MM-DD</li>
|
<li><code class="text-sm">endDate</code> — to set the end date (in format YYYY-MM-DD)</li>
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
<p>Example using HTTPie:</p>
|
|
||||||
<code>http get '{{script_protocol}}{{request.get_host}}{% url 'api:services' %}?uuid={{object.uuid}}&startDate=2021-01-01&endDate=2050-01-01' 'Authorization:Token {{request.user.api_token}}'</code>
|
|
||||||
<p>Example using cURL:</p>
|
<p>Example using cURL:</p>
|
||||||
<code>curl -H 'Authorization:Token {{request.user.api_token}}' '{{script_protocol}}{{request.get_host}}{% url 'api:services' %}?uuid={{object.uuid}}&startDate=2021-01-01&endDate=2050-01-01'</code>
|
<code class="text-sm">curl -H 'Authorization: Token {{request.user.api_token}}' '{{script_protocol}}{{request.get_host}}{% url 'api:services' %}?uuid={{object.uuid}}&startDate=2021-01-01&endDate=2050-01-01'</code>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user