Add API endpoint for Quota.availability

This commit is contained in:
Raphael Michel
2017-06-19 13:57:58 +02:00
parent 374cf08086
commit b21a928028
3 changed files with 76 additions and 1 deletions

View File

@@ -69,7 +69,7 @@ Endpoints
.. http:get:: /api/v1/organizers/(organizer)/events/(event)/quotas/(id)/
Returns information on one question, identified by its ID.
Returns information on one quota, identified by its ID.
**Example request**:
@@ -95,6 +95,46 @@ Endpoints
"variations": [1, 4, 5, 7]
}
:param organizer: The ``slug`` field of the organizer to fetch
:param event: The ``slug`` field of the event to fetch
:param id: The ``id`` field of the quota to fetch
:statuscode 200: no error
:statuscode 401: Authentication failure
:statuscode 403: The requested organizer/event does not exist **or** you have no permission to view this resource.
.. http:get:: /api/v1/organizers/(organizer)/events/(event)/quotas/(id)/availability/
Returns availability information on one quota, identified by its ID.
**Example request**:
.. sourcecode:: http
GET /api/v1/organizers/bigevents/events/sampleconf/quotas/1/availability/ HTTP/1.1
Host: pretix.eu
Accept: application/json, text/javascript
**Example response**:
.. sourcecode:: http
HTTP/1.1 200 OK
Vary: Accept
Content-Type: text/javascript
{
"available": true,
"available_number": 419,
"total_size": 1000,
"pending_orders": 25,
"paid_orders": 423,
"cart_positions": 7,
"blocking_vouchers": 126,
"waiting_list": 0
}
Note that ``total_size`` and ``available_number`` are ``null`` in case of unlimited quotas.
:param organizer: The ``slug`` field of the organizer to fetch
:param event: The ``slug`` field of the event to fetch
:param id: The ``id`` field of the quota to fetch