Access Control Integration

Authentication

A token must be specified with each request via the HTTP header. token: ${token}

Please note: The issued token can only be used to authenticate against the below /accessusers endpoints. They cannot be used against other endpoints of the vivenu API.

Formats

Datetime format: ISO Timestamp

Example:

new Date().toISOString(); // 2020-04-29T15:03:03.726Z

Code Example

The following code is written in javascript and for demo purposes only. You can find a detailed list of all endpoints just after the example.

const ax = require('axios');

const baseUrl = "https://vivenu.com/api/accessusers";
const token = "YOUR-TOKEN-HERE";
const eventId = "EventId to get ticket batches.";
const batchSize = 50;
let skip = 0;
let total = 0;

const getTickets = async (from = undefined, until = undefined) => {

    const axios = ax.create({
        headers: {
            "token": token,
        }
    });

    const service = async (eventId, batchSize, skip = undefined, from = undefined, until = undefined) => {
        try {
            let queryParams = {
                top: batchSize,
            };
            if(skip) {
                queryParams.skip = skip;
            }
            if(from) {
                queryParams.from = from;
            }
            if(until) {
                queryParams.until = until;
            }

            const queryString = Object.entries(queryParams).map(a => a.join("=")).join("&");
            const response = await axios.get(baseUrl + "/tickets/v2/" + eventId + "?" + queryString);
            return response.data;
        } catch (error) {
            console.error(error);
        }
    };

    const initialResponse  = await service(eventId, batchSize, skip, from, until);
    if(initialResponse) {
        total = initialResponse.total;
    }

    for(let i = 0; i <= total; i += batchSize) {
        const response = await service(eventId, batchSize, skip, from, until);
        if(response) {
            total = response.total;
        }
    }
};

(async () => {
    const startingDate = new Date().toISOString();
    await getTickets(undefined, undefined);

    let from = startingDate;

    setInterval(async () => {
        let until = new Date().toISOString();
        await getTickets(from, until);
        from = until;
    }, 10000);
})();

Endpoints

PUBLIC

Get all accessible Events

Returns a list of all events accessible for the device. This endpoint is often used when a user wants to select the event to do the checkin for.

Query

No supported query parameters
Responses
200
OK

Was this section helpful?

YesNo
get
/api/accessusers/events
Response
application/json
[
{
"_id": "string",
"name": "string"
}
]
PUBLIC

Get Tickets for an Event v2

Returns a paged response of all tickets for a given event. Devices usually fetch and page through this endpoint and persist the results on disk to provide an offline capability.

Query

top
Optional
number float

A limit on the number of objects to be returned. Can range between 1 and 1000.

skip
Optional
number float

The number of objects to skip for the requested result

from
Optional
string date-time

An ISO Timestamp to filter tickets where created_at | updated >= $from

until
Optional
string date-time

An ISO Timestamp to filter tickets where created_at | updated < $from

Responses
200
OK
400
Bad Request

Was this section helpful?

YesNo
get
/api/accessusers/tickets/v2/{eventId}
Response
application/json
{
"docs": [
{
"_id": "string",
"barcode": "string",
"name": "string",
"ticketTypeId": "string",
"ticketName": "string",
"priceCategoryId": "string",
"eventId": "string",
"sellerId": "string",
"createdAt": "2030-01-23T23:00:00.123Z",
"updatedAt": "2030-01-23T23:00:00.123Z",
"priceCategory": {
"categoryId": "string",
"description": "string"
},
"status": "VALID",
"area": "string",
"row": "string",
"seat": "string",
"discountId": "string",
"discount": "string",
"entry": [
"string"
]
}
],
"total": 1
}
PUBLIC

Get Ticket with barcode

Returns the ticket for a given barcode if existent. This endpoint is typically invoked when a device needs to validate a given barcode in realtime.

Query

eventId
Optional
string
Responses
200
OK
400
Bad Request
404
Not Found

Was this section helpful?

YesNo
get
/api/accessusers/tickets/{barcode}
Response
application/json
{
"_id": "string",
"barcode": "string",
"name": "string",
"ticketTypeId": "string",
"ticketName": "string",
"categoryRef": "string",
"priceCategoryId": "string",
"eventId": "string",
"sellerId": "string",
"createdAt": "2030-01-23T23:00:00.123Z",
"updatedAt": "2030-01-23T23:00:00.123Z",
"priceCategory": {
"categoryId": "string",
"description": "string"
},
"status": "VALID"
}
PUBLIC

Scan Ticket with barcode

Scans a ticket with a given barcode. This endpoint is typically invoked when a device needs to validate and scan a given barcode in realtime.

Query

No supported query parameters
Responses
200
OK
400
Bad Request
404
Not Found

Was this section helpful?

YesNo
post
/api/accessusers/tickets/{barcode}/scan
Response
application/json
{
"access": "GRANTED",
"ticket": {
"_id": "string",
"barcode": "string",
"name": "string",
"status": "VALID",
"ticketTypeId": "string",
"ticketName": "string",
"categoryRef": "string",
"eventId": "string",
"sellerId": "string",
"createdAt": "2030-01-23T23:00:00.123Z",
"updatedAt": "2030-01-23T23:00:00.123Z"
}
}
PUBLIC

Create scans

Payload

barcode
Required
string

The barcode of the ticket

scanned_at
Required
string date-time

An ISO Timestamp indicating when the ticket was scanned.

type
Required
string

Whether the scan succeeded or failed

OKFAIL
direction
Required
string

Indicates in which direction the scan was.

INOUT

Optional Attributes

Collapse all
ticketId
Optional
string
Responses
200
OK
400
Bad Request

Was this section helpful?

YesNo
post
/api/accessusers/scans/{eventId}
[
{
"ticketId": "string",
"barcode": "string",
"scanned_at": "2030-01-23T23:00:00.123Z",
"type": "OK",
"direction": "IN"
}
]
Response
application/json
{
"status": "OK"
}