Display api urls on service management page

This commit is contained in:
Paweł Jastrzębski 2022-01-05 09:02:23 +01:00
parent 7f60b3abff
commit 2aaadfe81c

View File

@ -32,8 +32,21 @@
</form> </form>
<hr class="sep h-4"> <hr class="sep h-4">
<div> <div>
<p class="label">API Token</p> <h5>API</h5>
<span class='chip ~info !normal'>{{request.user.api_token}}</span> <p>Service data can be accessed via API on url:</p>
<code>{{script_protocol}}{{request.get_host}}{% url 'api:services' %}?uuid={{object.uuid}}</code>
<p>
There are 3 optional query parameters:
<ul>
<li>startDate - to set start date in format YYYY-MM-DD</li>
<li>endDate - to set end date in format YYYY-MM-DD</li>
<li>basic - to get only basic data set to '1' or 'true'</li>
</ul>
</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&basic=1' 'Authorization:Token {{request.user.api_token}}'</code>
<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&basic=1'</code>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}