-
-
Notifications
You must be signed in to change notification settings - Fork 353
REST API v1
While we're working on exposing all Alf.io functionalities through APIs (this will happen in v2) we decided to develop a very simple API for creating / updating / deleting and retrieving event statistics.
- List Organizations
- Get Organization
- Create Organization
- Update Organization
- Delete Organization
- Create API Key for Organization
You must specify an API Client ApiKey in order to call the APIs.
curl -X POST http://localhost:8080/api/v1/admin/event/create \
-H "Authorization: ApiKey e210468a-1831-4cf2-93d8-8cc093c7bd7d" \
-H "Cache-Control: no-cache" -H "Content-Type: application/json" \
-d "REQUEST_BODY_JSON (see below)"
ApiKey can be:
- A system API Key for system-level requests (i.e. create a new organization)
- An organization-level API Key for creating events and creating reservations
You can create an organization-level API Key from your Alf.io instance. Select "API Key" from the top menu and then fill in the details.
Only the "admin" user can view and rotate the System API Key. Select "API Key" from the top menu. You'll see
in order to consume this APIs you must generate a Organization-level API Key
POST /api/v1/admin/event/create
Sample Body (Reference)
{
"title": "Titolo",
"slug": "titolo",
"description": [{
"lang": "de",
"body": "text description"
}],
"location": {
"fullAddress": "Pollegio 6742 Switzerland",
"coordinate": {
"latitude": "45.55",
"longitude": "9.00"
}
},
"timezone": "Europe/Zurich",
"startDate": "2018-08-12T08:00:00",
"endDate": "2018-08-12T09:00:00",
"websiteUrl": "http://www.amicidelticino.ch/aktivitaten/exklusivbesuch-des-kommandoturms-der-sbb",
"termsAndConditionsUrl": "http://www.amicidelticino.ch/agb",
"imageUrl": "https://www.amicidelticino.ch/assets/adt/images/amicidelticino-logo.png",
"tickets": {
"freeOfCharge": false,
"max": 10,
"currency": "CHF",
"taxPercentage": 7.7,
"taxIncludedInPrice": true,
"paymentMethods": ["ON_SITE"],
"categories": [
{
"name":"Standard",
"description": [{
"lang": "de",
"body": "text description"
}],
"maxTickets": null,
"accessRestricted": false,
"price": 10.0,
"startSellingDate": "2018-08-02T15:24:22",
"endSellingDate": "2018-08-12T07:00:00",
"groupLink": {
"groupId": 123,
"type": "LIMITED_QUANTITY",
"matchType": "EMAIL_DOMAIN",
"maxAllocation": 2
}
}
]
},
"extensionSettings": [{
"extensionId": "mailchimp",
"key":"listId",
"value":"your-list-id"
}]
}
- HTTP 200 {slug} - the given slug or a new, auto-generated one
- HTTP 400 Error descriptor
- HTTP 500 Error descriptor
POST /api/v1/admin/event/update/{slug}
Sample Body (Reference)
{
"title": "NewTitle",
"startDate": "2018-08-12T08:01:00"
}
- HTTP 200 {slug}
- HTTP 400 Error descriptor
- HTTP 500 Error descriptor
DELETE /api/v1/admin/event/{slug}
- HTTP 200 OK
- HTTP 400 Error descriptor
- HTTP 500 Error descriptor
POST /api/v1/admin/event/{slug}/reservation
Sample Body (Reference)
{
"tickets": [
{
"ticketCategoryId": 53,
"quantity": "1",
"metadata": [{
"attributeForTicket1": "value"
}]
},
{
"ticketCategoryId": 56,
"quantity": "2",
"metadata": [{
"attributeForTicket1": "value1"
}, {
"attributeForTicket2": "value2"
}]
}
],
"additionalServices": [
{
"additionalServiceId": 1,
"quantity": 1
}
],
"promoCode": null,
"user": {
"username": "[email protected]",
"firstName": "Test",
"lastName": "McTest",
"email": "[email protected]",
"id": "external-id"
}
}
-
HTTP 201
{ "success": true, "id": "reservation-id", "href": "public-url-for-reservation", "errors": null }
- HTTP 400 Error descriptor
- HTTP 500 Error descriptor
Name | Description | Mandatory |
---|---|---|
title | The event name | * |
slug | Short name, used in URLs | |
description | Array of i18n, Markdown-formatted descriptions | * |
description.lang | Language code | * |
description.body | Localized, Markdown formatted, text | * |
location | Event Location | * |
location.fullAddress | Location address | * |
location.coordinate | geolocation data: latitude and longitude | * |
timezone | time zone identifier (e.g. Europe/Zurich, see List of tz database time zones) | * |
startDate | start date/time, format: YYYY-MM-DDTHH:mm:SS | * |
endDate | start date/time, format: YYYY-MM-DDTHH:mm:SS | * |
websiteUrl | The URL of the event website (can be a dedicated page, or a generic website) | * |
termsAndConditionsUrl | T&C URL | * |
privacyPolicyUrl | Privacy Policy URL | |
imageUrl | URL for retrieving the Event Logo. Must be accessible from alf.io's server | * |
tickets | ticket categories definition | * |
tickets.freeOfCharge | whether or not the event is free of charge | * |
tickets.max | the maximum allowed seats | * |
tickets.currency | ISO 4217 currency code (e.g. CHF, EUR, USD) | if freeOfCharge is false |
tickets.taxPercentage | VAT/GST percentage | if freeOfCharge is false |
tickets.taxIncludedInPrice | Whether the prices are already VAT/GST inclusive | if freeOfCharge is false |
tickets.paymentMethods | Allowed Payment methods | if freeOfCharge is false |
tickets.categories | Available ticket categories | * |
tickets.categories[n].name | Name | * |
tickets.categories[n].description | i18n Localized descriptions | |
tickets.categories[n].maxTickets | Maximum tickets to allocate for this category | |
tickets.categories[n].accessRestricted | Make the category private and generate unique access codes for it. Requires maxTickets > 0 | |
tickets.categories[n].price | Ticket price for this category | if tickets.freeOfCharge is false |
tickets.categories[n].startSellingDate | Start Selling Date/Time | * |
tickets.categories[n].endSellingDate | End Selling Date/Time | * |
tickets.categories[n].groupLink | Tickets for this category can only be assigned to people in the given Group | |
tickets.categories[n].groupLink.groupId | Group ID | * |
tickets.categories[n].groupLink.type | Link type | * |
tickets.categories[n].groupLink.matchType | Matching type | * |
tickets.categories[n].groupLink.maxAllocation | max tickets allowed per match | if matchType is "LIMITED_QUANTITY" |
extensionSettings | settings for extensions | |
extensionSettings.extensionId | the id as defined in the Repository | * |
extensionSettings.key | extension setting key | * |
extensionSettings.value | extension setting value | * |
Name | Description | Mandatory |
---|---|---|
reservation | Tickets to reserve | * |
reservation.*.ticketCategoryId | Category ID | * |
reservation.*.quantity | number of tickets for the given category ID | * |
additionalService | additional items to reserve | |
additionalService.*.additionalServiceId | additional service ID | * |
additionalService.*.quantity | number of additional services items | * |
promoCode | promoCode to apply | |
user | authenticated user who is performing the reservation | |
user.username | username. Depending on the Authentication system in use, can be the user email | * |
user.firstName | First name | * |
user.lastName | Last name | * |
user.email | * | |
id | External ID, this attribute is currently ignored |
GET /api/v1/admin/system/organization/list
- HTTP 200 Array<Organization>
- HTTP 500 Error descriptor
GET /api/v1/admin/system/organization/{id}
- HTTP 200 Organization
- HTTP 404 Organization ID not found
- HTTP 500 Error descriptor
POST /api/v1/admin/system/organization/create
Sample Body (OrganizationModification)
{
"name": "New Organization",
"email": "[email protected]",
"description": "mandatory description"
}
- HTTP 200 Organization
- HTTP 400 Error descriptor
- HTTP 500 Error descriptor
POST /api/v1/admin/system/organization/{id}
Sample Body (OrganizationModification)
{
"id": 1,
"name": "New Name",
"email": "[email protected]",
"description": "mandatory description"
}
- HTTP 200 Organization
- HTTP 400 Error descriptor
- HTTP 500 Error descriptor
DELETE /api/v1/admin/system/organization/{id}
Warning This will delete all Events, Subscriptions, Reservations owned by the Organization you're deleting
- HTTP 200 OK
- HTTP 400 Error descriptor
- HTTP 500 Error descriptor
PUT /api/v1/admin/system/organization/{id}/api-key
-
HTTP 200 OrganizationApiKey
{ "organizationId": 123, "apiKey": "abcd" }
- HTTP 500 Error descriptor
We would like to thank
for sponsoring the development of this feature. Thank you!