diff --git a/src/templates/open-data.html b/src/templates/open-data.html index 3dfd928..e24d1e6 100644 --- a/src/templates/open-data.html +++ b/src/templates/open-data.html @@ -7,7 +7,7 @@

{% trans "If you are interested in any other data that is not provided by this API, please contact us via the ticketing system (you must be registered in order to create a ticket)." %}

{% trans "Retrieving data via API" %}

-

{% trans "Colab API works through HTTP/REST and always returning JSON objects." %}

+

{% trans "Colab API works through HTTP/REST, always returning JSON objects." %}

{% trans "The base API URL is" %}: {% url 'api_v1_top_level' api_name='v1' as BASE_API_URL %} @@ -21,30 +21,86 @@

@@ -75,9 +131,13 @@

...{{ BASE_API_URL }}ticket/?author__endswith={% trans "test" %}

...{{ BASE_API_URL }}message/?body__contains={% trans "test" %}

{% trans "Usage with related models" %}

+

{% trans "You can use related fields to filter too. So, you can filter by any field of emailaddress using the 'from_address' field of message, which has a relation to emailaddress. You will achieve the relation fields by using double underscore and the field's name. See the example below" %}

+

...{{ BASE_API_URL }}message/?from_address__real_name__contains=Name

+

{% trans "So, real_name is a field of emailaddress, and you had access to this field by a message field called from_address and using double underscore to say you want to use a field of that relation" %}

+

{% trans "Note: email filters must be exact. Which means that __contains, __startswith, __endswith and others won't work" %}

+

{% trans "Another example of usage with relations to retrieve all messages of a given username or email" %}

+

...{{ BASE_API_URL }}message/?from_address__user__username=username

...{{ BASE_API_URL }}message/?from_address__user__email=usermailexample@host.com

-

...{{ BASE_API_URL }}message/?from_address__real_name=Name

-

{% trans "Note: email filters must be exact." %}

-- libgit2 0.21.2