{% extends "admin/base_site_nav.html" %} {% load rest_framework %} {% load i18n %} {% block extrahead %}{{block.super}} {% endblock %} {% block tools %}

{% endblock %} {% block content %}
{% blocktrans with username=request.user.username %}This page helps developers to learn and experiment with the REST API of frePPLe.
This API allows your application to exchange information with frePPLe.

The "list API" link takes you to the object list page.
And the "detail API" link takes you to a specific object when you enter the object's primary key.
In these pages you will be able to perform HTTP requests with methods GET, POST, OPTIONS, PUT, PATCH and DELETE.
The results can be shown in JSON format or as HTML in your browser.

Using tools like 'wget' or 'curl' you can access the API from the command line.
For instance, to return the list of all sales orders in JSON format:

Basic authentication sends the user name and password in the request.
As long as you use HTTPS it is a simple and secure way of authentication.
wget --http-user={{username}} --http-password=PASSWORD {{url}}    
curl -u {{username}}:PASSWORD {{url}}    
JSON Web Token authentication uses a digitally signed token to prove a user's identity.
Below is a token we generated for the next days.
wget --header 'Authorization: Bearer {{token}}' {{url}}    
curl -H 'Accept: application/json' --header 'Authorization: Bearer {{token}}' {{url}}    
API keys are secret tokens you generate and manage on this page.
The secret key is shown only once to you and you need to store it safely.
wget --header 'Authorization: Bearer API_KEY' {{url}}    
curl -H 'Accept: application/json' --header 'Authorization: Bearer API_KEY' {{url}}    
{% endblocktrans %}
REST API
{% getMenu as menu %} {% for group in menu %} {% for item in group.1 %} {% if item.1.model and not item.1.excludeFromBulkOperations %} {% endif %} {% endfor %} {% endfor %}
{% trans 'List API' %}{% trans 'Detail API' %}
{{ group.0 }} - {{ item.0 }} {{request.prefix}}/api/{{ item.1.model|app_label }}/{{ item.1.model|short_model_name }}/ {{request.prefix}}/api/{{ item.1.model|app_label }}/{{ item.1.model|short_model_name }}/
{% endblock %}