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
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
[{"_id": "string","name": "string"}]
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
A limit on the number of objects to be returned. Can range between 1 and 1000.
The number of objects to skip for the requested result
An ISO Timestamp to filter tickets where created_at | updated >= $from
An ISO Timestamp to filter tickets where created_at | updated < $from
{"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}
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
{"_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"}
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
{"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"}}
Create scans
Payload
The barcode of the ticket
An ISO Timestamp indicating when the ticket was scanned.
Whether the scan succeeded or failed
OK
FAIL
Indicates in which direction the scan was.
IN
OUT
Optional Attributes
Collapse all[{"ticketId": "string","barcode": "string","scanned_at": "2030-01-23T23:00:00.123Z","type": "OK","direction": "IN"}]
{"status": "OK"}