Skip to content

tickets

larsverp edited this page Jun 24, 2020 · 8 revisions

The tickets endpoind is used to subscribe to an event. And creating and sending the QR code.

🚨FOR ALL TICKET ENDPOINTS AUTHENTICATION IS REQUIRED🚨

📄 Checklist

  • Create a get method, so the tickets can be shown.
  • Create a create method, so new tickets can be created.
  • Create a remove method, so the user can unsubscribe.
  • Create a tickets/scan for checking and accepting the tickets.
  • Create a ticket/resubscribe endpoint for subscribing after a ticket is cancelled.

📖 Get tickets(get method)

The get endpoints do not use any body text.

  • /api/tickets returns all tickets, containing an event_id. (Returns the tickets belonging to the current user)
❌ Errors:
  • [] - There are no tickets to show
✔️ On succes:

200 OK - returns a JSON object with all tickets.


✏️ Subscribe to an event(post method)

The post endpoints require all body data as described.

  • /api/tickets returns the data added to the DB.
    • event_id (required, uuid, exists in the event DB, The user didn't subscribe to this event yet) - The Event id.
❌ Errors:
  • Error is only trown when body data is incorrect. Errors are in english like the example below.
{
    "message": "The given data was invalid.",
    "errors": {
        "event_id": [
            "The event id has already been taken."
        ]
    }
}
✔️ On succes:

201 Created - returns a JSON object with the created ticket data.


🙅 Unsubscribe (post method)

The post endpoint require all body data as described.

  • /api/tickets/unsubscribe/{event_id} sets the ticket as unsubscribed.
    • reason (required, string, max:191)
❌ Errors:

404 Not found - The requested ticket does not exist

400 Bad Request - The ticket can't be updated

401 Unauthorized - This ticket does not belong to this user

✔️ On succes:

200 OK - returns a JSON object "message":"Unsubscribed".


📷 Scan qr code(post method)

THIS ENDPOINT IS USED IN THE APP THAT SCANS THE QR CODES

The post endpoints require all body data as described.

  • /api/tickets/scan returns status 200 - OK.
    • event_id (required, uuid, exists in event table) - The ID of the current event.
    • qr_data (required, string) - The data scanned from the qr code.
❌ Errors:
  • 406 - Not Acceptable - The ticket is already scanned
  • 409 - Conflict - The user unsubscribed from this event
✔️ On succes:

201 Created - does not return a JSON object.

Clone this wiki locally