{% extends "base.html" %} {% load staticfiles %} {% load wger_extras %} {% block title %}REST API{% endblock %} {% block content %}

wger Workout Manager provides a full REST API to all database objects: https://wger.de/api/v1/

The API uses HATEOAS, so you should be able to browse through the necessary endpoints without having to consult an extensive documentation. At the moment, the API only supports read operations, but support for full POST/PUT/DELETE/PATCH is planned for the near future.

You should always use HTTPS if possible when communicating with the server.

Authentication

Public endpoints, such as the list of exercises or the ingredients can be accessed without authentication. For user owned objects such as workouts, you need to generate an API KEY and pass it along with the username either in the header or in form of GET parameters. See the link on the sidebar for details.

Public endpoints

Private endpoints

Fetching Data

If you explore the API with a browser, you will need to add a ?format=json to these URLs. You don't need to do this when using other tools or when explicitly sending the Accept header to "application/json".

Api-Wide

curl https://wger.de/api/v1/ | python -m json.tool

This lists out all the different resources available. Each one is listed by the "resource_name" and provides the "list_endpoint" and the schema for the resource. Note that these links try to direct you to other parts of the API, to make exploration/discovery easier.

Getting A Collection Of Resources

curl https://wger.de/api/v1/exercise/ | python -m json.tool curl https://wger.de/api/v1/exercise/schema/ | python -m json.tool

You can also filter the resources, the syntax is the same as the Django ORM. Take a look at the field lookup documentation for more details on how to use the individual lookups. The following field lookups are supported, but don't always make sense for all fields (in that case you'll just get an emtpy result). Alternatively you can just specify the IDs you want or provide an offset.

Some examples:

curl https://wger.de/api/v1/exercise/?name__istartswith=bicep | python -m json.tool curl https://wger.de/api/v1/exercise/?status__in=2,4,5 | python -m json.tool curl https://wger.de/api/v1/exercise/?language=1 | python -m json.tool curl https://wger.de/api/v1/exercise/?category__name__istartswith=ba | python -m json.tool curl https://wger.de/api/v1/exercise/1/ | python -m json.tool # quoting needed for bash curl "https://wger.de/api/v1/exercise/set/1;3/" | python -m json.tool curl "https://wger.de/api/v1/exercise/?offset=20&limit=20" | python -m json.tool

{% endblock %} {% block sidebar %}
This is also new for us, if you plan on using the API, we'd love to hear from you.

Browse the API

Generate API KEY

{% endblock %}