{% extends 'ddm/admin/generic/page_with_form.html' %} {% block page_title %}Project Access Token{% endblock %} {% block main_heading %}Manage Project Access Token{% endblock %} {% block main_top %}

The collected data of a project can be accessed remotely through the download API. For this to work, an access token must be created. Access tokens are project-specific.
Access tokens are valid for a limited time (maximum 120 days). After the current token has expired, a new one must be created.

The download API endpoint for this project is https://{{ request.get_host }}/api/project/{{ project.pk }}/data/.
When making a request, prefix your token with "Token " and include this string in the Authorization HTTP header. {% if project.super_secret %} Because this is a super secret project, the secret must also be provided in an HTTP header named "Super-Secret" (e.g., GET https://{{ request.get_host }}/{{ project.pk }}/download/ -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b' -H 'Super-Secret: y0urSuperSecr3t'). {% else %} (e.g., GET https://{{ request.get_host }}/api/project/{{ project.pk }}/data/ -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'). {% endif %}

An example on how this can be used to retrieve the data directly from within your R- or Python-scripts can be found here.
Current Token
{% if token %}
{{ token.key }}
{{ token.created|date:"M d, Y, H:i" }}
{{ token.expiration_date|date:"M d, Y, H:i" }}
{% if token.has_expired %}Invalid{% else %}valid{% endif %}
{% csrf_token %} {{ form.media }}
{% else %}

A token has yet to be created.

{% endif %}
{% endblock %} {% block main_form_header %}Create new Token{% endblock %} {% block main_form %}
{% csrf_token %} {{ form.media }}
{% if form.errors %}

The form could not be processed. Please check the issues highlighted below.

{% endif %} {{ form.non_field_errors }} {% for field in form %} {% if field.name in 'expiration_days' %}

The new token expires in {{ field }} days.

The new token will overwrite the existing one and the current token will no longer work.

{% else %} {{ field }} {% endif %} {% endfor %} {% block cancel %}

🠐 Back

{% endblock %}
{% endblock %} {% block breadcrumbs %} Projects / "{{ project.name|truncatechars:15 }}" Project / Manage Access Token {% endblock %}