diff --git a/doc/plugins/pretixdroid.rst b/doc/plugins/pretixdroid.rst index d62ac2206d..e0a5db573b 100644 --- a/doc/plugins/pretixdroid.rst +++ b/doc/plugins/pretixdroid.rst @@ -27,8 +27,8 @@ uses to communicate with the pretix server. Content-Type: text/json { - 'status': 'ok' - 'version': 2 + "status": "ok" + "version": 2 } **Example error response**: @@ -39,9 +39,9 @@ uses to communicate with the pretix server. Content-Type: text/json { - 'status': 'error', - 'reason': 'already_redeemed', - 'version': 2 + "status": "error", + "reason": "already_redeemed", + "version": 2 } Possible error reasons: @@ -76,19 +76,19 @@ uses to communicate with the pretix server. Content-Type: text/json { - 'results': [ + "results": [ { - 'secret': 'az9u4mymhqktrbupmwkvv6xmgds5dk3', - 'order': 'ABCE6', - 'item': 'Standard ticket', - 'variation': null, - 'attendee_name': 'Peter Higgs', - 'redeemed': false, - 'paid': true + "secret": "az9u4mymhqktrbupmwkvv6xmgds5dk3", + "order": "ABCE6", + "item": "Standard ticket", + "variation": null, + "attendee_name": "Peter Higgs", + "redeemed": false, + "paid": true }, ... ], - 'version': 2 + "version": 2 } :query query: Search query @@ -118,38 +118,50 @@ uses to communicate with the pretix server. Content-Type: text/json { - 'checkins': 17, - 'total': 42, - 'version': 2, - 'items': [ + "checkins": 17, + "total": 42, + "version": 2, + "event": { + "name": "Demo Converence", + "slug": "democon", + "date_from": "2016-12-27T17:00:00Z", + "date_to": "2016-12-30T18:00:00Z", + "timezone": "UTC", + "url": "https://demo.pretix.eu/demoorga/democon/", + "organizer": { + "name": "Demo Organizer", + "slug": "demoorga" + }, + }, + "items": [ { - 'name': 'T-Shirt', - 'id': 1, - 'checkins': 1, - 'admission': False, - 'total': 1, - 'variations': [ + "name": "T-Shirt", + "id": 1, + "checkins": 1, + "admission": False, + "total": 1, + "variations": [ { - 'name': 'Red', - 'id': 1, - 'checkins': 1, - 'total': 12 + "name": "Red", + "id": 1, + "checkins": 1, + "total": 12 }, { - 'name': 'Blue', - 'id': 2, - 'checkins': 4, - 'total': 8 + "name": "Blue", + "id": 2, + "checkins": 4, + "total": 8 } ] }, { - 'name': 'Ticket', - 'id': 2, - 'checkins': 15, - 'admission': True, - 'total': 22, - 'variations': [] + "name": "Ticket", + "id": 2, + "checkins": 15, + "admission": True, + "total": 22, + "variations": [] } ] } diff --git a/src/pretix/plugins/pretixdroid/views.py b/src/pretix/plugins/pretixdroid/views.py index 36e3e69762..549fb63a7d 100644 --- a/src/pretix/plugins/pretixdroid/views.py +++ b/src/pretix/plugins/pretixdroid/views.py @@ -15,6 +15,8 @@ from django.views.generic import TemplateView, View from pretix.base.models import Checkin, Event, Order, OrderPosition from pretix.control.permissions import EventPermissionRequiredMixin from pretix.helpers.urls import build_absolute_uri +from pretix.multidomain.urlreverse import \ + build_absolute_uri as event_absolute_uri logger = logging.getLogger('pretix.plugins.pretixdroid') API_VERSION = 2 @@ -139,6 +141,18 @@ class ApiStatusView(ApiView): def get(self, request, **kwargs): response = { 'version': API_VERSION, + 'event': { + 'name': str(self.event), + 'slug': self.event.slug, + 'organizer': { + 'name': str(self.event.organizer), + 'slug': self.event.organizer.slug + }, + 'date_from': self.event.date_from, + 'date_to': self.event.date_to, + 'timezone': self.event.settings.timezone, + 'url': event_absolute_uri(self.event, 'presale:event.index') + }, 'checkins': Checkin.objects.filter( position__order__event=self.event ).count(),