NAV Navbar
json php

Introduction

ExperienceBank API consists of four sections: Partner API, Public API, Notification API and Distributor API.

Partner API needs to be implemented on Provider side. ExperienceBank will use these endpoints to pull Content and push bookings and cancellations.

Public API should be used by clients to create/enable/disable suppliers in ExperienceBank, get list of supported Marketplaces, enable/disable marketplace mappings, etc.

Notification API should be used to notify ExperienceBank about changes in Partner's system.

Distributor API should be used by Distributors to get all Content and push bookings and cancellations.

Partner API

This API has to be implemented on Partner side. ExperienceBank will call this API to get Activities and Availabilities and push and cancel bookings on your platform.

All response bodies are JSON and all request bodies are expected to be JSON.

Required notifications to be implemented on your side are:

Authorization

All requests must contain a valid Authorization header authenticating the client and proving the integrity of the request.

ExperienceBank uses public keys and message signing to authenticate clients. A ExperienceBank representative will give you your own public and secret keys.

Clients must send an Authorization header in the following format:

Authorization: "Basic " + BASE64($PUBLICKEY + ":" + HMAC_SHA256(BASE64($REQUESTID), $SECRETKEY))

$PUBLICKEY - The client's public key, e.g. pub_b0f41d7fe0e51ea45018358df7f1e12d09580053c3

$SECRETKEY - The client's secret key, e.g. sec_dacd7d383558188d90c6d0b8bdc36a9b028500c6f3

$REQUESTID - Header's X-REQUEST-IDENTIFIER value, e.g. 6da9ef63-5593-48cd-b088-efaef26104fe

Activities

Example Response

{
  "links": {
    "next": "https://example.com/supplier/1234/activities?offset=50"
  },
  "data": [
    {
      "id": "48016",
      "title": "The Best of Zürich City Tour",
      "description": "Discover this unique city, several times winner of the award "City with the world's best quality of life" and see its different faces. During the journey you will pass by the "Must see" of the beautiful town.\r\n\r\nDeparture point: \r\nSihlquai Coach Parking - Bus parking near Main Station.\r\nwww.switzerland-tours.ch/travelinfos\r\n\r\nCheck-In: \r\nPlease check-in at our ticket office marked with "Best of Switzerland Tours" at the latest 15 minutes prior to departure.",
      "highlights": "",
      "itinerary": "<p>Pass by the castle-like National Museum, the well-known&nbsp;shopping avenue Bahnhofstrasse&nbsp;and Z&uuml;rich&#39;s famous&nbsp;financial district. Picture stop at the port of &quot;Enge&quot; where you enjoy beautiful vistas of the crystal-clear&nbsp;Lake Z&uuml;rich. Continue along the lake, passing by the renowned Opera House to the &quot;Z&uuml;richberg&quot; district with many superb mansions of glorious past times. A great experience is the ride uphill by&nbsp;cogwheel train&nbsp;(Dolderbahn) to a&nbsp;viewpoint&nbsp;where the noble five-star Grand Hotel Dolder is located. Enjoy breath-taking views of the city, the lake and the snow-covered Alps. Cruising the&nbsp;university quarter, you see the Swiss Federal Institute of Technology (ETH), the University of Z&uuml;rich and Z&uuml;rich&#39;s art museum before reaching the&nbsp;charming Old Town. The last picture stop of this versatile excursion offers views of the patriarchal guild houses, the St. Peter church with Europe&#39;s largest clock-face, the Grossm&uuml;nster church and the Fraum&uuml;nster church with the famous stained glass windows by Marc Chagall. After a short walk through the Old Town, the tour ends here or with a scenic drive back on&nbsp;Limmatquai&nbsp;at Sihlquai bus parking.</p>\r\n\r\n<p>&nbsp;</p>",
      "language": "en",
      "destination": {
        "countryCode": "CH",
        "code": "ZRH",
        "name": "Zürich"
      },
      "media": {
        "images": {
          "header": "https://cdn.something.com/234o9234/12342009.png",
          "teaser": "https://cdn.something.com/234o9234/12342002.png",
          "gallery": [
            "https://cdn.something.com/234o9234/12342003.png",
            "https://cdn.something.com/234o9234/12342004.png",
            "https://cdn.something.com/234o9234/12342005.png"
          ]
        },
        "videos": [
          "//youtu.be/CIrttJhJCqM",
          "//youtu.be/CIrttJhJCq1"
        ]
      },
      "route": [
        {
          "name": "Zürich",
          "latitude": "47.376887",
          "longitude": "8.541694"
        }
      ],
      "guestFields": [
        {
          "code": "gender",
          "label": "Gender",
          "type": "radio",
          "required": false,
          "options": [
            {
              "key": "m",
              "value": "Male"
            },
            {
              "key": "f",
              "value": "Female"
            }
          ]
        },
        {
          "code": "email",
          "label": "Email",
          "type": "text",
          "required": true,
          "options": null
        }
      ],
      "addons": [
        {
          "id": "3457",
          "title": "T-shirt",
          "type": "guest",
          "description": "T-shirt with funny picture on it",
          "price": {
            "amount": "10.00",
            "currency": "USD"
          }
        }
      ],
      "isActive": true,
      "options": [
        {
          "id": "42964496428-0900",
          "name": "The Best of Zürich City Tour B2  APR 18 - MAR 19 (English)",
          "duration": "PT3H",
          "startTime": "09:00:00",
          "fromDate": "2018-01-15",
          "untilDate": "2019-03-01",
          "cutOff": 1440,
          "weekdays": [
            "mon",
            "sun"
          ],
          "canBeBookedAfterStartTime": false,
          "ticketCategories": [
            {
              "id": "12342",
              "name": "Adult",
              "minSeats": 1,
              "maxSeats": 1,
              "isGroup": false,
              "price": {
                "type": "fixed",
                "amount": "49.00",
                "currency": "EUR"
              }
            },
            {
              "id": "CHILD",
              "name": "Child",
              "minSeats": 1,
              "maxSeats": 1,
              "isGroup": false,
              "price": {
                "type": "fixed",
                "amount": "20.00",
                "currency": "EUR"
              }
            },
            {
              "id": "12346",
              "name": "GROUP 2-10",
              "minSeats": 2,
              "maxSeats": 10,
              "isGroup": true,
              "price": {
                "type": "variable",
                "amount": "200.00",
                "currency": "EUR"
              }
            }
          ]
        },
        {
          "id": "42964496428-1000",
          "name": "The Best of Zürich City Tour B2  APR 18 - MAR 19 (English)",
          "duration": "PT3H",
          "startTime": "10:00:00",
          "fromDate": "2018-01-15",
          "untilDate": "2019-03-01",
          "cutOff": 0,
          "weekdays": [
            "fri",
            "sat"
          ],
          "canBeBookedAfterStartTime": true,
          "ticketCategories": [
            {
              "id": "12342",
              "name": "Adult",
              "minSeats": 1,
              "maxSeats": 1,
              "isGroup": false,
              "price": {
                "type": "fixed",
                "amount": "49.00",
                "currency": "EUR"
              }
            },  
            {
              "id": "123461",
              "name": "GROUP 1-5",
              "minSeats": 1,
              "maxSeats": 5,
              "isGroup": true,
              "price": {
                "type": "fixed",
                "amount": "150.00",
                "currency": "EUR"
              }
            }
          ]
        }   
      ],
      "translations": [
        {
          "language": "de",
          "title": "Stadtrundfahrt: Das Beste von Zürich",
          "description": "Beschreibung: Entdecken Sie Zürich, wichtigster wirtschaftlicher und kultureller Standort der Schweiz und mehrfach als \"Stadt mit der höchsten Lebensqualität\" ausgezeichnet, auf dieser 2-stündigen, klassischen Stadtrundfahrt. Während der Fahrt im komfortablen, klimatisierten Reisebus zeigt Ihnen Ihre versierte Reiseleitung die bedeutendsten Sehenswürdigkeiten dieser bezaubernden Stadt. Abfahrtsort: Zürich Sihlquai Carparkplatz hinter dem Zürich Hauptbahnhof (HB) Detaillierte Beschreibung: www.switzerland-tours.ch/de/reiseinformationen/abfahrtsort Check-In: Wir bitten Sie, sich spätestens 15 Minuten vor Abfahrt bei unseren Mitarbeitern am Abfahrtsort zu melden.",
          "highlights": "",
          "itinerary": "Geniessen Sie die Fahrt vorbei am schlossähnlichen Landesmuseum, dem Hauptbahnhof, der luxuriösen Einkaufsmeile Bahnhofstrasse und Zürichs Zentrum für Finanz und Wirtschaft. Nach einem ersten Fotostop am malerischen Zürichseefolgen Sie dem See über die Quaibrücke und vorbei am berühmten Opernhaus. Anschliessend Fahrt mit der Dolder-Zahnradbahn ins Zürichbergquartier mit seinen Villen aus vergangenen Zeiten und dem renommierten 5-Sterne Hotel The Dolder Grand. Geniessen Sie die einmalige Aussicht auf die Stadt, den See und die schneebedeckten Berge. Auf der Weiterfahrt durch das Universitätsviertel sehen Sie die Eidgenössische Technische Hochschule (ETH), die Universität sowie das Kunsthaus Zürich und erreichen dann die charmante Altstadt. Der letzte Fotostopp der abwechslungsreichen Tour bietet Aussicht auf die patriarchalen Zunfthäuser, die Kirche St. Peter mit dem grössten Kirchenzifferblatt Europas, das Grossmünster und das Fraumünster mit seinen berühmten Farbfenstern von Marc Chagall. Nach einem kurzen Altstadtbummel endet die Tour hier oder mit einer malerischen Fahrt entlang des Limmatquais am Sihlquai Busparkplatz. Inklusiv: -Geführte Tour in Deutsch und Englisch -Audioguides: Chinesisch, Japanisch, Russisch und Spanisch -Busfahrt im komfortablen Reisebus -Zahnradbahnfahrt Exklusiv: -Essen -Getränke -Persönliche Ausgaben"
        }
      ]
    }
  ]
}

Example Error Response

{
  "errors": [
    {
      "status": "500",
      "code": "InternalServerError",
      "title": "Internal Server Error",
      "details": "Something went wrong"
    }
  ]
}

HTTP Request

GET /supplier/{partnerSupplierId}/activities?id[]=48016

Path

Parameter Type Required Description
partnerSupplierId string yes Internal Partner Supplier ID. This ID will be provided to ExperienceBank by Partner

Query

Parameter Type Required Description
id array no Array of supplier’s activities IDs. If IDs not specified endpoint should return all activities

Response

Name Type Required Description
links
object
yes Links object
  next string, null yes Link to the next data batch. Can be null if all data was returned. ExperienceBank will use this link to request next batch of data so this link must be a valid URL
data array yes Array of activities
  id string yes Activity Id
  title string yes Activity Title
  description string yes Activity Description. Can contain HTML
  highlights string yes Activity Highlights. Can contain HTML
  itinerary string yes Activity Itinerary. Can contain HTML
  language string yes Activity language
  destination object yes Object contains information about Activity destination
    countryCode string yes Destination country code
    code string yes Destination code
    name string yes Destination name
  media object yes Object contains information about media resources (images, videos)
    images object yes Object contains information about header, teaser and gallery images
      header string, null yes Header image url. Can be null
      teaser string, null yes Teaser image url . Can be null
      gallery array yes Array of image urls. Can be empty array []
    videos array yes Array of videos urls. Can be empty array []
  route array yes Array of route points. Can be empty array [] if not supported
    name string yes Route point name
    latitude string yes Route point latitude
    longitude string yes Route point longitude
  guestFields array yes Array of activity guest fields. Can be empty array [] if not supported
    code string yes Guest field code
    label string yes Guest field label
    type string yes Guest field type. Can be radio, text, select, etc
    required boolean yes Is guest field required?
    options array yes Array of options if available. Some types like radio or select can have options.
      key string yes Guest field option key
      value string yes Guest field option value
  addons array yes Array of activity addons
    id string yes Addon Id
    title string yes Addon Title
    description string yes Addon Description
    type string yes Addon Type. Can be guest or item. Depends on this value addon will be added on guest or booking item level on booking request.
    price object yes Addon Price Information
      amount string yes Addon Price amount
      currency string yes Addon Price currency
  isActive boolean yes Is activity active
  options array yes Array of activity options
    id string yes Option Id
    name string yes Option name
    duration string yes Option duration. Has PnYnMnDTnHnMnS format, e.g. P1D. More details
    startTime string yes Option start time. Has hh:mm:ss format, e.g. 09:00:00. More details
    fromDate string yes Option from date. Has YYYY-MM-DD format, e.g. 2018-12-10. More details
    untilDate string yes Option until date. Has YYYY-MM-DD format, e.g. 2018-12-10. More details
    cutOff integer yes Minutes before activity start when bookings are not allowed
    weekdays array yes Array of weekdays when activity is available. Possible values: mon, tue, wed, thu, fri, sat, sun. Can be empty [] if option is not recurrent.
    canBeBookedAfterStartTime boolean yes If true then this option can be booked after its start time, f.e. if option start time is 09:00:00 it can be booked at 10:00:00 or 11:00:00 and so on. Works for museums, etc
    ticketCategories array yes Array of option ticket categories
      id string yes Ticket Category Id
      name string yes Ticket Category name
      minSeats integer yes Minimum seats required to book this ticket category
      maxSeats integer yes Maximum seats allowed to book this ticket category
      isGroup boolean yes Is this ticket category GROUP ticket category. If false it means that ticket category is Single Seat
      price object yes Ticket Category price information
        type string yes Can be fixed or variable. If fixed total amount for booked guests will be price of this ticket category. If variable - price will be multiplied by guests count, e.g. if ticket category Adult has fixed price 100 EUR and 5 guests were booked total price will be still 100 EUR. If it had variable price type total price would be 500 EUR
        amount string yes Price amount
        currency string yes Price currency
  translations array yes Array of translations. Can be empty array [] if not supported
    language string yes Translation language
    title string yes Translation Activity Title
    description string yes Translation Activity Description. Can contain HTML
    highlights string yes Translation Activity Highlights. Can contain HTML
    itinerary string yes Translation Activity Itinerary. Can contain HTML

Error

Name Type Required Description
errors array yes Array of errors
  status string yes Error status
  code string yes Error code
  title string yes Error title
  details string, null yes Error details

Availabilities

Example Response

{
  "links": {
    "next": "https://example.com/supplier/1234/availabilities?offset=50&dateRangeStart=2018-05-14&dateRangeEnd=2019-05-30"
  },
  "data": [
    {
      "dateTime": "2018-01-16T09:00:00+02:00",
      "availableCapacity": 10,
      "maximumCapacity": 20,
      "activityId": "235455",
      "optionId": "43234234234-0900",
      "ticketCategories" : [
        {
          "id" : "345343",
          "availableCapacity": 10
        },
        {
          "id" : "445353",
          "availableCapacity": 0
        },
        {
          "id" : "645653",
          "availableCapacity": null
        }
      ]
    }
  ]
}

Example Error Response

{
  "errors": [
    {
      "status": "500",
      "code": "InternalServerError",
      "title": "Internal Server Error",
      "details": "Something went wrong"
    }
  ]
}

HTTP Request

GET /supplier/{partnerSupplierId}/availabilities?dateRangeStart=2018-12-11&dateRangeEnd=2019-12-11&activityId[]=14587&optionId[]=478799789-0900&optionId[]=4789875259-1000

Path

Parameter Type Required Description
partnerSupplierId string yes Internal Partner Supplier ID. This ID will be provided to ExperienceBank by Partner

Query

Parameter Type Required Description
dateRangeStart string yes Start date of date range. Has YYYY-MM-DD format, e.g. 2018-12-10. More details
dateRangeEnd string yes End date of date range. Has YYYY-MM-DD format, e.g. 2019-12-10. More details
activityId array no Array of activity ids. Can be omitted
optionId array no Array of option ids. Can be omitted

Response

Name Type Required Description
links
object
yes Links object
  next string, null yes Link to the next data batch. Can be null if all data was returned. ExperienceBank will use this link to request next batch of data so this link must be a valid URL
data array yes Array of availabilities
  datetime string yes The date/time of the activity using the ISO 8601 datetime format (e.g. 2018-12-11T14:00:00+02:00). We always expect the local time with its UTC offset.
  availableCapacity integer yes Available capacity
  maximumCapacity integer yes Maximum capacity
  activityId string yes Activity Id
  optionId string yes Option Id
  ticketCategories array yes Array of ticket categories available capacities. Can be empty [] if available capacities by ticket categories not supported. If you have availability limitations by ticket category and a ticket category doesn't have availabilities for specified date or was blocked you need to return 0 for this ticket category because if you don't provide this information we will check availableCapacity on availability level only
    id string yes Ticket category id
    availableCapacity integer, null yes Ticket category available capacity. Can be null if not applicable. In this case we will treat as no limitation by ticket category

Error

Name Type Required Description
errors array yes Array of errors
  status string yes Error status
  code string yes Error code
  title string yes Error title
  details string, null yes Error details

Create Booking

Example Request

{
  "data": {
    "bookingId": "boo_35b4951f-644a-4af6-85ce-c02209598f61",
    "bookingItems": [
      {
        "date": "2018-01-20",
        "optionId": "434131423412-0900",
        "guests": [
          {
            "firstName": "John",
            "lastName": "Doe",
            "email": "john.doe@example.com",
            "phoneNumber": "+474998799654",
            "occupancy": 1,
            "ticketId": "tic_b830ab21-4d83-45cc-809e-a4b436c7ad93",
            "ticketCategory": "123422",
            "additionalFields": [
              {
                "key": "gender",
                "value": "m"
              },
              {
                "key": "nationality",
                "value": "BY"
              }
            ],
            "addons" : [
              {
                "id": "642342",
                "quantity": 1
              }
            ]
          },
          {
            "firstName": "",
            "lastName": "",
            "email": "",
            "phoneNumber": "",
            "occupancy": 1,
            "ticketId": "tic_b8565c12-2195-4dab-9e5a-06c74dd1fcd3",
            "ticketCategory": "123422",
            "additionalFields": [],
            "addons": []
          },
          {
            "firstName": "",
            "lastName": "",
            "email": "",
            "phoneNumber": "",
            "occupancy": 1,
            "ticketId": "tic_bfeb1422-2c89-4dde-a4f0-c10cd9d3a092",
            "ticketCategory": "123422",
            "additionalFields": [],
            "addons": []
          }
        ],
        "addons" : [
            {
              "id": "842348",
              "quantity": 5
            }
        ]
      }
    ],

    "marketplace": {
      "id": "mar_22550105-a751-4e65-88f4-9ff47d335652",
      "bookingId": "7902023020232021"
    },
    "contact": {
      "fullName": "John Doe",
      "email": "john.doe@example.com",
      "phoneNumber": "+474998799654"
    },
    "payment": {
      "amount": "100.00",
      "currency": "EUR"
    },
    "notes": "Some additional remarks related to the booking"
  }
}

Example Response

{
  "data": {
    "partnerBookingId": "11000232",
    "tickets": [
      {
        "ticketId": "tic_34383d4e-59c7-456a-b60a-ad1bacb4bb37",
        "partnerTicketId": "GUE-13981214-12888383"
      },
      {
        "ticketId": "tic_0ff829b5-7060-4bec-83eb-21e4310ef287",
        "partnerTicketId": "GUE-13981214-12888384"
      },
      {
        "ticketId": "tic_34cf83d4e-59c7-456a-b60a-ad1bacb4bb37",
        "partnerTicketId": "GUE-13981214-12888385"
      }
    ]
  }
}

Example Error Response

{
  "errors": [
    {
      "status": "500",
      "code": "InternalServerError",
      "title": "Internal Server Error",
      "details": "Something went wrong"
    }
  ]
}

HTTP Request

POST /supplier/{partnerSupplierId}/booking

Path

Parameter Type Required Description
partnerSupplierId string yes Internal Partner Supplier ID. This ID will be provided to ExperienceBank by Partner

Body

Parameter Type Required Description
data
object
yes Request data
  bookingId string yes Booking Id from ExperienceBank system
  bookingItems array yes Array of Booking Items
    date string yes Activity/Trip date. Has YYYY-MM-DD format, e.g. 2018-12-10. More details
    optionId string yes Option Id
    guests array yes Array of guests
      firstName string yes Guest first name. Can be empty ""
      lastName string yes Guest last name. Can be empty ""
      email string yes Guest email. Can be empty ""
      phoneNumber string yes Guest phone number. Can be empty ""
      occupancy integer yes Guest occupancy. Cannot be less than 1
      ticketId string yes ExperienceBank ticket id. This value will be send to Marketplaces and can be used as QR code so if your system supports QR code validation it should support ExperienceBank ticket ids as well as they might be printed on Marketplace vouchers
      ticketCategory string yes Ticket category id
      additionalFields array yes Array of additional fields. Can be empty []
        key string yes Additional field key
        value string yes Additional field value
      addons array yes Array of addons on guest level. Can be empty []
        id string yes Addon id
        quantity string yes Addon quantity
    addons array yes Array of addons on booking item level. Can be empty []
      id string yes Addon id
      quantity string yes Addon quantity
  marketplace object yes Marketplace info
    id string yes Marketplace id from ExperienceBank system:
Expedia: mar_7485d4af-a1dd-4822-9568-553f27c744c7
GetYourGuide: mar_a8b6748e-8e7c-407c-91e0-4d985227ef30
Viator: mar_9ab1e224-f170-4989-a208-1d54497d4673
    bookingId string yes Marketplace booking id
  contact object yes Contact info
    fullName string, null yes Contact full name. Can be null
    email string, null yes Contact email. Can be null
    phoneNumber string, null yes Contact phone number. Can be null
  payment object, null yes Payment info. Can be null
    amount string, null yes Payment amount
    currency string, null yes Payment currency
  notes string, null yes Booking notes. Can be null

Response

Name Type Required Description
data
object
yes Response data
  partnerBookingId string yes Booking Id from Partner System
  tickets array yes Tickets array
    ticketId string yes Ticket id from ExperienceBank system
    partnerTicketId string yes Ticket id from Partner system

Error

Name Type Required Description
errors array yes Array of errors
  status string yes Error status
  code string yes Error code
  title string yes Error title
  details string, null yes Error details

Cancel Booking

Example Request

{
  "data": {
    "reason": "No travelling anymore",
    "note": "Some additional notes about cancellation"
  }
}

Example Response

{
  "data": {
    "partnerBookingId": "11000232"
  }
}

Example Error Response

{
  "errors": [
    {
      "status": "404",
      "code": "BookingNotFound",
      "title": "Booking Not Found",
      "details": "Booking #2323 not found"
    }
  ]
}

HTTP Request

POST /supplier/{partnerSupplierId}/booking/{bookingId}/cancellation

Path

Parameter Type Required Description
partnerSupplierId string yes Internal Partner Supplier ID. This ID will be provided to ExperienceBank by Partner
bookingId string yes ExperienceBank Booking Id

Body

Parameter Type Required Description
data object yes Cancellation data
  reason string, null yes Cancellation reason. Can be null
  note string, null yes Cancellation note. Can be null

Responses

Name Type Required Description
data object yes Cancellation response data
  partnerBookingId string yes Booking Id from Partner's system

Error

Name Type Required Description
errors array yes Array of errors
  status string yes Error status
  code string yes Error code
  title string yes Error title
  details string, null yes Error details

Public API

Public API is used by clients to create suppliers in ExperienceBank system, pull Marketplaces info, etc. In order to have access to API you must have public key and secret key which are provided by ExperienceBank. when account is created for your marketplace. Please contact us for more details

The base URL for all API requests is https://api.trekkconnect.com/v1. The API only speaks JSON-RPC. All response bodies are JSON and all request bodies are expected to be JSON.

All requests must contain a valid Authorization header authenticating the client and proving the integrity of the request.

If you system speaks PHP you can use our SDK to speed up your integration

Authorization

If you test requests with Postman you can use this pre-request script to sign all requests to ExperienceBank

var apiKey = postman.getEnvironmentVariable('publicKey'),
    apiSecret = postman.getEnvironmentVariable('secretKey'),
    hash = CryptoJS.HmacSHA256(base64url(request.data), apiSecret);

pm.environment.set('authToken', "Basic " + b64EncodeUnicode(apiKey+':'+hash));
function base64url(input) {
    var base64String = b64EncodeUnicode(input);
    base64String = base64String.replace(/=+$/, '');
    base64String = base64String.replace(/\+/g, '-');
    base64String = base64String.replace(/\//g, '_');

    return base64String;
}

function b64EncodeUnicode(str) {
    return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,
        function toSolidBytes(match, p1) {
            return String.fromCharCode('0x' + p1);
    }));
}

Clients must send an Authorization header in the following format:

Authorization: "Basic " + BASE64($PUBLICKEY + ":" + HMAC_SHA256(BASE64($REQUEST_BODY), $SECRETKEY))

$PUBLICKEY - The client's public key, e.g. pub_b0f41d7fe0e51ea45018358df7f1e12d09580053c3

$SECRETKEY - The client's secret key, e.g. sec_dacd7d383558188d90c6d0b8bdc36a9b028500c6f3

$REQUEST_BODY - Request body, e.g. {"jsonrpc":"2.0","method":"activity.find","params":{"query":{"supplierId":"sup_16648235-3751-4dbd-a3fd-81470fd913d3","activityIds":[],"cursor":null}},"id":1}

Create Supplier

Example Request

{
  "jsonrpc": "2.0",
  "method": "supplier.create",
  "params": {
    "name": "Amazing Supplier",
    "partner": "par_a136d0c8-8e3a-4590-bed6-37ca35a7f9eb",
    "partnerSupplierId": "110154",
    "contact": {
      "name": "John Doe",
      "email": "john.doe@example.com"
    }
  },
  "id": 1
}
$response = $apiClient->supplier()->create([
    'name'=> 'Amazing Demo Activities',
    'partnerSupplierId' => '15873',
    'partner' => 'par_049a72c3-7a8d-48aa-94d1-0ba5a8e9e9f2',
    'contact' => [
        'name' => 'John Doe',
        'email' => 'another@example.com'
    ]
]);

Example Response

{
  "jsonrpc": "2.0",
  "result": {
    "supplierId": "sup_a26498a0-094a-4133-8b42-e8bdbe6fbd65"
  },
  "id": 1
}

Example Error Response

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "The method does not exist / is not available."
  },
  "id": 1
}

Method

supplier.create

Params

Name Type Required Description
name
string yes Supplier name
partner string yes Partner Id from ExperienceBank system
partnerSupplierId string yes Supplier Id from Partner's system
contact object yes Contact object. This data will be used to create Supplier Admin User
  name string yes Contact person name
  email string yes Contact person email

Result

Name Type Description
supplierId
string
Supplier Id from ExperienceBank system

Error

Name Type Description
code integer Error code. See JSON RPC Specification
message string Error message
data object Error details if available
  errors object Errors key-value object

Enable Supplier

Example Request

{ 
  "jsonrpc": "2.0",
  "method": "supplier.enable",
  "params": {
    "supplierId" : "sup_b9c2f6a1-7f77-4065-a016-bc84a6522d44"
  },
  "id": 1
}
$response = $apiClient->supplier()->enable('sup_b9c2f6a1-7f77-4065-a016-bc84a6522d44');

Example Response

{
  "jsonrpc": "2.0",
  "result": {},
  "id": 1
}

Example Error Response

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "The method does not exist / is not available."
  },
  "id": 1
}

Method

supplier.enable

Params

Name Type Required Description
supplierId
string yes Supplier Id from ExperienceBank

Result

Name Type Description

Error

Name Type Description
code integer Error code. See JSON RPC Specification
message string Error message
data object Error details if available
  errors object Errors key-value object

Disable Supplier

Example Request

{ 
  "jsonrpc": "2.0",
  "method": "supplier.disable",
  "params": {
    "supplierId" : "sup_b9c2f6a1-7f77-4065-a016-bc84a6522d44"
  },
  "id": 1
}
$response = $apiClient->supplier()->disable('sup_b9c2f6a1-7f77-4065-a016-bc84a6522d44');

Example Response

{
  "jsonrpc": "2.0",
  "result": {},
  "id": 1
}

Example Error Response

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "The method does not exist / is not available."
  },
  "id": 1
}

Method

supplier.disable

Params

Name Type Required Description
supplierId
string yes Supplier Id from ExperienceBank

Result

Name Type Description

Error

Name Type Description
code integer Error code. See JSON RPC Specification
message string Error message
data object Error details if available
  errors object Errors key-value object

Enable Mapping

Example Request

{ 
  "jsonrpc": "2.0",
  "method": "mapping.enable",
  "params": {
    "supplierId" : "sup_16648235-3751-4dbd-a3fd-81470fd913d3",
    "marketplaceId" : "mar_31ff966a-3430-4176-869e-1958e922f82c",
    "partnerId": "par_7c2acbce-f407-45d3-bef7-c5e16bb484c2"
  },
  "id": 1
}
$response = $apiClient->mapping()->enable($supplierId, $marketplaceId, $partnerId);

Example Response

{
  "jsonrpc": "2.0",
  "result": {
      "mappingId" : "map_23638c44-3f5c-45aa-a352-877bda99c415"
  },
  "id": 1
}

Example Error Response

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "The method does not exist / is not available."
  },
  "id": 1
}

Method

mapping.enable

Params

Name Type Required Description
supplierId
string yes Supplier Id from ExperienceBank
marketplaceId string yes Marketplace Id from ExperienceBank
partnerId string yes Partner Id

Result

Name Type Description
mappingId
string
Marketplace Mapping Id from ExperienceBank system

Error

Name Type Description
code integer Error code. See JSON RPC Specification
message string Error message
data object Error details if available
  errors object Errors key-value object

Disable Mapping

Example Request

{ 
  "jsonrpc": "2.0",
  "method": "mapping.disable",
  "params": {
    "mappingId" : "map_f6ce4ebe-2534-4515-8b3d-aed2814337db"
  },
  "id": 1
}
$response = $apiClient->mapping()->disable($mappingId);

Example Response

{
  "jsonrpc": "2.0",
  "result": {
      "mappingId" : "map_f6ce4ebe-2534-4515-8b3d-aed2814337db"
  },
  "id": 1
}

Example Error Response

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "The method does not exist / is not available."
  },
  "id": 1
}

Method

mapping.disable

Params

Name Type Required Description
mappingId
string yes Marketplace Mapping Id from ExperienceBank

Result

Name Type Description
mappingId
string
Marketplace Mapping Id from ExperienceBank system

Error

Name Type Description
code integer Error code. See JSON RPC Specification
message string Error message
data object Error details if available
  errors object Errors key-value object

Marketplaces List

Example Request

{ 
  "jsonrpc": "2.0",
  "method": "marketplace.find",
  "params": {
    "query" : {
        "marketplaces": [],
        "statuses": ["enabled"]
    }
  },
  "id": 1
}

Example Response

{
    "jsonrpc": "2.0",
    "result": {
        "data": [
            {
                "id": "mar_af330f69-3a02-4629-8d60-d763113230c8",
                "name": "HotelBeds Group",
                "description": "Hotelbeds Group is the largest distributor of tours and activities in the world. Connect now to distribute your products across a large network of re-sellers.",
                "status": "enabled",
                "isEnabled": true
            }
        ]
    },
    "id": 1
}

Example Error Response

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "The method does not exist / is not available."
  },
  "id": 1
}

Method

marketplace.find

Params

Name Type Required Description
query
object yes Query
  marketplaces array yes Marketplaces Ids. Can be empty []
  statuses array yes Statuses. Can be empty []. Allowed values: enabled, disabled, coming soon

Result

Name Type Description
data
array
Marketplaces data
  id string Marketplace id
  name string Marketplace name
  description string Marketplace description
  status string Marketplace status. Possible values: enabled, disabled, coming soon
  isEnabled boolean Is marketplace enabled

Error

Name Type Description
code integer Error code. See JSON RPC Specification
message string Error message
data object Error details if available
  errors object Errors key-value object

Generate Auto Login Url

Example Request

{ 
  "jsonrpc": "2.0",
  "method": "supplier.generateAutoLoginUrl",
  "params": {
      "supplierId" : "sup_ee9f3fbe-72b7-4677-8a91-a76c5325b635",
      "email": "john.doe@example.com",
      "redirectUrl" : {
        "targetPage" : "mapping",
        "data" : {
          "mappingId" : "map_ddc45875-bdf5-4811-9519-f3a5d99eebdf"
        }
      }
  },
  "id": 1
}
$response = $apiClient->supplier()
    ->generateAutoLoginUrl('sup_ee9f3fbe-72b7-4677-8a91-a76c5325b635', 'john.doe@example.com')
    ->forMapping('map_ddc45875-bdf5-4811-9519-f3a5d99eebdf');

Example Response

{
    "jsonrpc": "2.0",
    "result": {
        "url": "https://backoffice.trekkconnect.com/a/l/auto_71d3b0b7534ce6e3047bef397e0958e60fe43f9f97"
    },
    "id": 1
}

Example Error Response

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "The method does not exist / is not available."
  },
  "id": 1
}

Method

supplier.generateAutoLoginUrl

Params

Name Type Required Description
supplierId
string yes Supplier Id from ExperienceBank
marketplaceId string yes Marketplace Id from ExperienceBank
email string yes User email
redirectUrl object yes Redirect Url settings
  targetPage string yes Page you want to redirect the user. It can be dashboard or mapping page for a specific marketplace. Possible values: dashboard, mapping
  data object yes Redirect url data
    mappingId string, null yes Mapping Id is used when targetPage is mapping. Can be null. If null and targetPage is mapping the user will be redirected to Dashboard anyway

Result

Name Type Description
url
string
Auto Login Url

Error

Name Type Description
code integer Error code. See JSON RPC Specification
message string Error message
data object Error details if available
  errors object Errors key-value object

Notification API

In order to have access to API you must have public key and secret key which are provided by ExperienceBank. Please contact us for more details

The base URL for all API requests is https://api.trekkconnect.com/v1. The API only speaks JSON-RPC. All response bodies are JSON and all request bodies are expected to be JSON.

All requests must contain a valid Authorization header authenticating the client and proving the integrity of the request.

If you system speaks PHP you can use our SDK to speed up your integration

Authorization

If you test requests with Postman you can use this pre-request script to sign all requests to ExperienceBank

var apiKey = postman.getEnvironmentVariable('publicKey'),
    apiSecret = postman.getEnvironmentVariable('secretKey'),
    hash = CryptoJS.HmacSHA256(base64url(request.data), apiSecret);

pm.environment.set('authToken', "Basic " + b64EncodeUnicode(apiKey+':'+hash));
function base64url(input) {
    var base64String = b64EncodeUnicode(input);
    base64String = base64String.replace(/=+$/, '');
    base64String = base64String.replace(/\+/g, '-');
    base64String = base64String.replace(/\//g, '_');

    return base64String;
}

function b64EncodeUnicode(str) {
    return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,
        function toSolidBytes(match, p1) {
            return String.fromCharCode('0x' + p1);
    }));
}

Clients must send an Authorization header in the following format:

Authorization: "Basic " + BASE64($PUBLICKEY + ":" + HMAC_SHA256(BASE64($REQUEST_BODY), $SECRETKEY))

$PUBLICKEY - The client's public key, e.g. pub_b0f41d7fe0e51ea45018358df7f1e12d09580053c3

$SECRETKEY - The client's secret key, e.g. sec_dacd7d383558188d90c6d0b8bdc36a9b028500c6f3

$REQUEST_BODY - Request body, e.g. {"jsonrpc":"2.0","method":"activity.find","params":{"query":{"supplierId":"sup_16648235-3751-4dbd-a3fd-81470fd913d3","activityIds":[],"cursor":null}},"id":1}

Activity Updated

Example Request

{
  "jsonrpc": "2.0",
  "method": "activity.updated",
  "params": {
    "activityId": "23222",
    "partnerSupplierId": "15873"
  },
  "id": null
}

Example Response

{
  "jsonrpc": "2.0",
  "result": {},
  "id": null
}

Example Error Response

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "The method does not exist / is not available."
  },
  "id": null
}

Method

activity.updated

Params

Name Type Required Description
activityId
string yes Activity Id from Partner's system
partnerSupplierId string yes Supplier Id from Partner's system

Result

Name Type Description

Error

Name Type Description
code integer Error code. See JSON RPC Specification
message string Error message
data object Error details if available
  errors object Errors key-value object

Availability Updated

Example Request

{
  "jsonrpc": "2.0",
  "method": "availability.updated",
  "params": {
    "activityId": "23222",
    "partnerSupplierId": "15873",
    "optionId": "49239022023-0900",
    "fromDate": "2018-01-18",
    "toDate": "2018-01-18"
  },
  "id": null
}

Example Response

{
  "jsonrpc": "2.0",
  "result": {},
  "id": null
}

Example Error Response

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "The method does not exist / is not available."
  },
  "id": null
}

Method

availability.updated

Params

Name Type Required Description
activityId
string yes Activity Id from Partner's system
partnerSupplierId string yes Supplier Id from Partner's system
optionId string yes Option Id from Partner's system
fromDate string yes Date from which to update availabilities. Must have YYYY-MM-DD format. More details
toDate string yes Date to which to update availabilities. Must have YYYY-MM-DD format. More details

Result

Name Type Description

Error

Name Type Description
code integer Error code. See JSON RPC Specification
message string Error message
data object Error details if available
  errors object Errors key-value object

Booking Cancelled

Example Request

{
  "jsonrpc": "2.0",
  "method": "booking.cancelled",
  "params": {
    "bookingId": "boo_35b4951f-644a-4af6-85ce-c02209598f61"
  },
  "id": null
}

Example Response

{
  "jsonrpc": "2.0",
  "result": {},
  "id": null
}

Example Error Response

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "The method does not exist / is not available."
  },
  "id": null
}

Method

booking.cancelled

Params

Name Type Required Description
bookingId
string yes Booking Id from ExperienceBank

Result

Name Type Description

Error

Name Type Description
code integer Error code. See JSON RPC Specification
message string Error message
data object Error details if available
  errors object Errors key-value object

Ticket Affected

Example Request

{
  "jsonrpc": "2.0",
  "method": "ticket.affected",
  "params": {
    "ticketId": "tic_3cf83d4e-59c7-456a-b60a-ad1bacb4bb37",
    "status": "cancelled",
    "date": "2018-06-07T17:01:21+0000"
  },
  "id": null
}

Example Response

{
  "jsonrpc": "2.0",
  "result": {},
  "id": null
}

Example Error Response

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "The method does not exist / is not available."
  },
  "id": null
}

Method

ticket.affected

Params

Name Type Required Description
ticketId
string yes Ticket Id from ExperienceBank
status string yes Status. Possible values: created, cancelled, redeemed
date string yes Date of action. Must be datetime format (e.g. 2018-12-11T14:00:00+02:00) ISO 8601

Result

Name Type Description

Error

Name Type Description
code integer Error code. See JSON RPC Specification
message string Error message
data object Error details if available
  errors object Errors key-value object

Distributor API

Distributor API is used by distributors to pull inventory and create/cancel bookings in ExperienceBank system. In order to have access to API you must have public key and secret key which are provided by ExperienceBank when account is created for your marketplace. Please contact us for more details

The base URL for all API requests is https://api.trekkconnect.com/v1. The API only speaks JSON-RPC. All response bodies are JSON and all request bodies are expected to be JSON.

All requests must contain a valid Authorization header authenticating the client and proving the integrity of the request.

If you system speaks PHP you can use our SDK to speed up your integration

Authorization

If you test requests with Postman you can use this pre-request script to sign all requests to ExperienceBank

var apiKey = postman.getEnvironmentVariable('publicKey'),
    apiSecret = postman.getEnvironmentVariable('secretKey'),
    hash = CryptoJS.HmacSHA256(base64url(request.data), apiSecret);

pm.environment.set('authToken', "Basic " + b64EncodeUnicode(apiKey+':'+hash));
function base64url(input) {
    var base64String = b64EncodeUnicode(input);
    base64String = base64String.replace(/=+$/, '');
    base64String = base64String.replace(/\+/g, '-');
    base64String = base64String.replace(/\//g, '_');

    return base64String;
}

function b64EncodeUnicode(str) {
    return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,
        function toSolidBytes(match, p1) {
            return String.fromCharCode('0x' + p1);
    }));
}

Clients must send an Authorization header in the following format:

Authorization: "Basic " + BASE64($PUBLICKEY + ":" + HMAC_SHA256(BASE64($REQUEST_BODY), $SECRETKEY))

$PUBLICKEY - The client's public key, e.g. pub_b0f41d7fe0e51ea45018358df7f1e12d09580053c3

$SECRETKEY - The client's secret key, e.g. sec_dacd7d383558188d90c6d0b8bdc36a9b028500c6f3

$REQUEST_BODY - Request body, e.g. {"jsonrpc":"2.0","method":"activity.find","params":{"query":{"supplierId":"sup_16648235-3751-4dbd-a3fd-81470fd913d3","activityIds":[],"cursor":null}},"id":1}

Activities List

Example Request

{ 
  "jsonrpc": "2.0",
  "method": "activity.find",
  "params": {
      "query" : {
          "supplierId" : "sup_16648235-3751-4dbd-a3fd-81470fd913d3",
          "activityIds": ["act_28f8a3d7-611d-47a2-a34c-16cc780745de"],
          "cursor": null
        }
  },
  "id": 1
}
use TrekkConnect\Sdk\ApiClient\Client;
use TrekkConnect\Sdk\ApiClient\Credentials;
use TrekkConnect\Sdk\ApiClient\Methods\Activity\Query;

$credentials = new Credentials(
    getenv('API_PUBLIC_KEY'),
    getenv('API_SECRET_KEY')
);

$client = new Client($credentials);
$response = $client->activity()->find(
    new Query(
        'sup_16648235-3751-4dbd-a3fd-81470fd913d3',
        ['act_28f8a3d7-611d-47a2-a34c-16cc780745de']
    )
);

Example Response

{
    "jsonrpc": "2.0",
    "result": {
        "cursor": {
            "next": "MAe="
        },
        "data": [
            {
                "activityId": "act_28f8a3d7-611d-47a2-a34c-16cc780745de",
                "supplierId": "sup_16648235-3751-4dbd-a3fd-81470fd913d3",
                "title": "Amazing Walking Tour",
                "description": "<p>lorem ipsum</p>",
                "highlights": "<p>Tlorem ipsum</p>",
                "media": {
                    "images": {
                        "header": "https://cdn.example.com/185105/600x400-1-50-e4d927f71de3263b99ad46fae2a1d146.jpg",
                        "teaser": "https://cdn.example.com/185105/600x400-1-50-e4d927f71de3263b99ad46fae2a1d146.jpg",
                        "gallery": [
                            "https://cdn.example.com/185105/600x400-1-50-f4d923f71de2263b99a246fae2a3d146.jpg",
                            "https://cdn.example.com/285105/600x400-1-50-a4de7f71dee3b99ad46fae2a36.jpg",
                            "https://cdn.example.com/385105/600x400-1-50-e4d927f71de26339ad46fae2a1d146.jpg",
                            "https://cdn.example.com/485105/600x400-1-50-h4d9df71de3263b99ad46fae2a1d146.jpg"
                        ]
                    },
                    "videos": [
                        "//www.youtube.com/watch?v=-1V1oZ3IGPw"
                    ]
                },
                "options": [
                    {
                        "optionId": "opt_cd1adf6b-3e68-4780-9779-dbd0f6dbef46",
                        "name": "09:00 AM Walking Tour",
                        "duration": "PT4H",
                        "startTime": "09:00:00",
                        "fromDate": "2018-10-29",
                        "untilDate": "2018-11-30",
                        "cutOffInMinutes": 0,
                        "weekdays": ["mon", "sat", "sun"],
                        "isActive": true,
                        "ticketCategories": [
                            {
                                "ticketCategoryId": "8892760",
                                "name": "Adult",
                                "minSeats": 1,
                                "maxSeats": 1,
                                "isGroup": false,
                                "price": {
                                    "type": "fixed",
                                    "amount": "23.00",
                                    "currency": "EUR"
                                },
                                "isActive": true
                            }                          
                        ]
                    },
                    {
                        "optionId": "opt_fad3864a-7058-41d1-99e6-5d32a5a4f785",
                        "name": "09:00 AM Walking Tour",
                        "duration": "PT4H",
                        "startTime": "10:00:00",
                        "fromDate": "2018-10-29",
                        "untilDate": "2018-11-30",
                        "cutOffInMinutes": 0,
                        "weekdays": ["mon", "tue", "wed", "thu", "fri", "sat", "sun"],
                        "isActive": true,
                        "ticketCategories": [
                            {
                                "ticketCategoryId": "8892760",
                                "name": "Adult",
                                "minSeats": 1,
                                "maxSeats": 1,
                                "isGroup": false,
                                "price": {
                                    "type": "fixed",
                                    "amount": "23.00",
                                    "currency": "EUR"
                                },
                                "isActive": true
                            },
                            {
                                "ticketCategoryId": "8892761",
                                "name": "GROUP 1-10",
                                "minSeats": 1,
                                "maxSeats": 10,
                                "isGroup": true,
                                "price": {
                                    "type": "variable",
                                    "amount": "10.00",
                                    "currency": "EUR"
                                },
                                "isActive": true
                            }
                        ]
                    }
                ],
                "addons": [
                  {
                    "addonId": "23453234",
                    "title": "T-Shirt",
                    "description" : "Amazing T-Shirt",
                    "type": "guest",
                    "price" : {
                      "amount" : "10.00",
                      "currency" : "USD"
                    }
                  }
                ],
                "guestFields": [
                    {
                        "code": "gender",
                        "label": "Gender",
                        "type": "radio",
                        "required": true,
                        "options": [
                            {
                                "key": "m",
                                "value": "Male"
                            },
                            {
                                "key": "f",
                                "value": "Female"
                            }
                        ]
                    }                              
                ]
            }
        ]
    },
    "id": 1
}

Example Error Response

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "The method does not exist / not available."
  },
  "id": 1
}

Method

activity.find

Params

Name Type Required Description
query
object
yes Query object
  supplierId string yes Supplier Id
  activityIds array yes Array of activity ids. Can be empty array [] to get data about all activities
  cursor string, null yes Cursor to the next batch of data. Can be null

Result

Name Type Description
cursor
object
Cursor object
  next string, null Cursor pointer to the next data batch. Can be null if all data was returned
data array Array of activities
  activityId string Activity Id
  supplierId string Supplier Id
  title string Activity Title
  description string Activity Description. Can contain HTML
  highlights string Activity Highlights. Can contain HTML
  media object Object contains information about media resources (images, videos)
    images object Object contains information about header, teaser and gallery images
      header string, null Header image url. Can be null
      teaser string, null Teaser image url . Can be null
      gallery array Array of image urls. Can be empty array []
    videos array Array of videos urls. Can be empty array []
  addons array Array of activity addons
    addonId string Addon Id
    title string Addon Title
    description string Addon Description
    type string Addon Type. Can be guest or item. Depends on this value you should add this addon on guest or booking item level on booking request.
    price object Addon Price Information
      amount string Addon Price amount
      currency string Addon Price currency
  guestFields array Array of activity guest fields
    code string Guest field code
    label string Guest field label
    type string Guest field type. Can be radio, text, select, etc
    required boolean Is guest field required?
    options array Array of options if available. Some types like radio or select can have options.
      key string Guest field option key
      value string Guest field option value
  options array Array of activity options
    optionId string Option Id
    name string Option name
    duration string Option duration. Has PnYnMnDTnHnMnS format. More details
    startTime string Option start time. Has hh:mm:ss format. More details
    fromDate string Option from date. Has YYYY-MM-DD format. More details
    untilDate string Option until date. Has YYYY-MM-DD format. More details
    cutOffInMinutes integer Minutes before activity start when bookings are not allowed
    weekdays array Array of weekdays when activity is available. Possible values: mon, tue, wed, thu, fri, sat, sun. Can be empty [] if option is not recurrent.
    isActive boolean Option state
    ticketCategories array Array of option ticket categories
      ticketCategoryId string Ticket Category Id
      name string Ticket Category name
      minSeats integer Minimum seats required to book this ticket category
      maxSeats integer Maximum seats allowed to book this ticket category
      isGroup boolean Is this ticket category GROUP ticket category. If false it means that ticket category is Single Seat
      isActive boolean Ticket Category state
      price object Ticket Category price information
        type string Can be fixed or variable. If fixed total amount for booked guests will be price of this ticket category. If variable - price will be multiplied by guests count, e.g. if ticket category Adult has fixed price 100 EUR and 5 guests were booked total price will be still 100 EUR. If it had variable price type total price would be 500 EUR
        amount string Price amount
        currency string Price currency

Error

Name Type Description
code integer Error code. See JSON RPC Specification
message string Error message
data object Error details if available
  errors object Errors key-value object

Availabilities List

Example Request

{ 
  "jsonrpc": "2.0",
  "method": "availability.find",
  "params": {
    "query" : {
        "supplierId" : "sup_16648235-3751-4dbd-a3fd-81470fd913d3",
        "activityId": "act_28f8a3d7-611d-47a2-a34c-16cc780745de",
        "fromDate": "2018-11-14",
        "untilDate": "2020-11-10",
        "optionIds": ["opt_f4e6624b-75c8-43f9-b9f7-06200acc59c5"],
        "cursor": "MAe="
    }
  },
  "id": 1
}
use TrekkConnect\Sdk\ApiClient\Client;
use TrekkConnect\Sdk\ApiClient\Credentials;
use TrekkConnect\Sdk\ApiClient\Methods\Availability\Query;

$credentials = new Credentials(
    getenv('API_PUBLIC_KEY'),
    getenv('API_SECRET_KEY')
);

$client = new Client($credentials);
$response = $client->availability()->find(
    new Query(
        'sup_16648235-3751-4dbd-a3fd-81470fd913d3',
        'act_28f8a3d7-611d-47a2-a34c-16cc780745de',
        '2018-11-14',
        '2020-11-10',
        ['opt_f4e6624b-75c8-43f9-b9f7-06200acc59c5'],
        'MAe='
    )
);

Example Response

{
    "jsonrpc": "2.0",
    "result": {
        "cursor": {
            "next": "MAe="
        },
        "data": [
            {
                "supplierId": "sup_16648235-3751-4dbd-a3fd-81470fd913d3",
                "activityId": "act_28f8a3d7-611d-47a2-a34c-16cc780745de",
                "optionId": "opt_f4e6624b-75c8-43f9-b9f7-06200acc59c5",
                "localDate": "2019-05-30",
                "localTime": "09:00:00",
                "availableCapacity": 999,
                "maximumCapacity": 999,
                "ticketCategories" : [
                    {
                        "ticketCategoryId" : "8388433",
                        "name": "Adult",
                        "minSeats": 1,
                        "maxSeats": 1,
                        "availableCapacity": 999,
                        "price": {
                            "amount": "59.00",
                            "currency": "EUR"
                        }
                    },
                    {
                        "ticketCategoryId" : "5388435",
                        "name": "Child",
                        "minSeats": 1,
                        "maxSeats": 1,
                        "availableCapacity": 999,
                        "price": {
                            "amount": "45.00",
                            "currency": "EUR"
                        }
                    }
                ]
            },
            {
                "supplierId": "sup_16648235-3751-4dbd-a3fd-81470fd913d3",
                "activityId": "act_28f8a3d7-611d-47a2-a34c-16cc780745de",
                "optionId": "opt_f4e6624b-75c8-43f9-b9f7-06200acc59c5",
                "localDate": "2019-05-31",
                "localTime": "09:00:00",
                "availableCapacity": 980,
                "maximumCapacity": 999,
                "ticketCategories" : [
                    {
                        "ticketCategoryId" : "8388433",
                        "name": "Adult",
                        "minSeats": 1,
                        "maxSeats": 1,
                        "availableCapacity": 980,
                        "price": {
                            "amount": "59.00",
                            "currency": "EUR"
                        }
                    },
                    {
                        "ticketCategoryId" : "5388435",
                        "name": "Child",
                        "minSeats": 1,
                        "maxSeats": 1,
                        "availableCapacity": 979,
                        "price": {
                            "amount": "45.00",
                            "currency": "EUR"
                        }
                    }
                ]
            }
        ]
    },
    "id": 1
}

Example Error Response

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "The method does not exist / not available."
  },
  "id": 1
}

Method

availability.find

Params

Name Type Required Description
query
object
yes Query object
  supplierId string yes Supplier Id
  activityId string yes Activity Id
  fromDate string yes Date range from date. Must have YYYY-MM-DD format. More details
  untilDate string yes Date range until date. Must have YYYY-MM-DD format. More details
  optionIds array yes Array of option ids. Can be empty array [] to get availabilities for all option
  cursor string, null yes Cursor to the next batch of data. Can be null

Result

Name Type Description
cursor
object
Cursor object
  next string, null Cursor pointer to the next data batch. Can be null if all data was returned
data array Array of availabilities
  supplierId string Supplier Id
  activityId string Activity Id
  optionId string Option Id
  localDate string Local Date
  localTime string Local start time. Has hh:mm:ss format. More details
  availableCapacity integer Option Available capacity
  maximumCapacity integer Option Maximum capacity
  ticketCategories array Array of ticket categories available capacities. Can be empty [] if available capacities by ticket categories are not supported
    ticketCategoryId string Ticket category id
    availableCapacity integer, null Ticket category available capacity. Can be null if not applicable
      name string Ticket Category name
      minSeats integer Minimum seats required to book this ticket category
      maxSeats integer Maximum seats allowed to book this ticket category
      price object Ticket Category price information
        amount string Price amount
        currency string Price currency

Error

Name Type Description
code integer Error code. See JSON RPC Specification
message string Error message
data object Error details if available
  errors object Errors key-value object

Create Booking

Example Request

{
    "jsonrpc": "2.0",
    "method": "booking.create",
    "params": {
        "supplierId": "sup_16648235-3751-4dbd-a3fd-81470fd913d3",
        "bookingItems": [{
            "activityId": "act_28f8a3d7-611d-47a2-a34c-16cc780745de",
            "optionId": "opt_f4e6624b-75c8-43f9-b9f7-06200acc59c5",
            "date": "2019-05-30",
            "ticketCategories": [{
                "ticketCategory": "8892762",
                "count": 3
            }]
        }],
        "holdDurationSeconds": 300
    },
    "id": 1
}

use TrekkConnect\Sdk\ApiClient\Client;
use TrekkConnect\Sdk\ApiClient\Credentials;
use TrekkConnect\Sdk\ApiClient\Methods\Booking\CreateBookingRequest;
use TrekkConnect\Sdk\ApiClient\Methods\Booking\BookingItem;
use TrekkConnect\Sdk\ApiClient\Methods\Booking\TicketCategory;

$credentials = new Credentials(
    getenv('API_PUBLIC_KEY'),
    getenv('API_SECRET_KEY')
);

$client = new Client($credentials);
$response = $client->booking()->create(
    new CreateBookingRequest(
    'sup_16648235-3751-4dbd-a3fd-81470fd913d3',
     300,
     [
        new BookingItem(
            'act_28f8a3d7-611d-47a2-a34c-16cc780745de',
            'opt_f4e6624b-75c8-43f9-b9f7-06200acc59c5',
            '2019-05-30',
            [
                new TicketCategory('8892762', 3)
            ]
        )
     ]
    )
);

Example Response

{
    "jsonrpc": "2.0",
    "result": {
        "bookingId": "boo_aa31d25d-e6b1-4dda-a13d-3e719fc4f114",
        "expiresAt": 1543486437
    },
    "id": 1
}

Example Error Response

{
    "jsonrpc": "2.0",
    "error": {
        "code": 0,
        "message": "Availability for Option Id \"opt_f4e6624b-75c8-43f9-b9f7-06200acc59c5\" and date \"2018-05-30\" was not found"
    },
    "id": 1
}

Method

booking.create

Params

Name Type Required Description
supplierId
string yes Supplier Id
holdDurationSeconds integer yes Duration in seconds for which availabilities should be reserved
bookingItems array yes Array of Booking Items
  activityId string yes Activity Id
  optionId string yes Option Id
  date string yes Local date. Must have YYYY-MM-DD format. More details
  ticketCategories array yes Array of Ticket Categories. Cannot be empty
    ticketCategory string yes Ticket Category id
    count integer yes Ticket Category count. For ticket categories which are not GROUP you should send them with count: 1. So if you have 5 Adult which are not GROUP you should send 5 ticket categories with count: 1. In case of GROUP ticket category you can pass count more than 1 like count: 5

Result

Name Type Description
bookingId
string
Booking Id
expiresAt integer Timestamp when reservation expires

Error

Name Type Description
code integer Error code. See JSON RPC Specification
message string Error message
data object Error details if available
  errors object Errors key-value object

Commit Booking

Example Request

{ 
  "jsonrpc": "2.0",
  "method": "booking.commit",
  "params": {
    "supplierId" : "sup_16648235-3751-4dbd-a3fd-81470fd913d3",
    "bookingId": "boo_8dd17a9e-17f4-4e6f-a5c4-dca7682c8321",
    "bookingItems" : [
      {
        "activityId": "act_28f8a3d7-611d-47a2-a34c-16cc780745de",
        "optionId" : "opt_f4e6624b-75c8-43f9-b9f7-06200acc59c5",
        "date": "2019-05-30",
        "ticketCategories" : [
          {
            "ticketCategory" : "8892762",
            "count" : 1,
            "externalTicketId": "ext_1"
          }
        ],
        "guests": [
          {
            "firstName": "John",
            "lastName": "Doe",
            "emailAddress": "johndoe@example.com",
            "phoneNumber": "+12345678901",
            "addons" : [
                {
                  "id": "44267",
                  "quantity": 2
                }
            ],
            "additionalFields" : [
                {
                  "key" : "gender",
                  "value" : "m"
                },
                {
                  "key" : "nationality",
                  "value" : "CH"
                }
            ] 
          }
        ],
        "addons" : [
          {
            "id": "44268",
            "quantity": 5
          }
        ]
      }
    ],
    "externalBookingReference": "4434531234354",
    "notes": "Some special requirements",
    "payment" : {
      "amount" : "50",
      "currency" : "USD"
    },
    "contact" : {
      "fullName": "John Doe",
      "email": "john.doe@example.com",
      "phoneNumber": "+474998799654"
    }
  },
  "id": 1
}

use TrekkConnect\Sdk\ApiClient\Client;
use TrekkConnect\Sdk\ApiClient\Credentials;
use TrekkConnect\Sdk\ApiClient\Methods\Booking\CommitBookingRequest;
use TrekkConnect\Sdk\ApiClient\Methods\Booking\Commit\BookingItem;
use TrekkConnect\Sdk\ApiClient\Methods\Booking\TicketCategory;
use TrekkConnect\Sdk\ApiClient\Methods\Booking\Payment;
use TrekkConnect\Sdk\ApiClient\Methods\Booking\Contact;
use TrekkConnect\Sdk\ApiClient\Methods\Booking\Guest;
use TrekkConnect\Sdk\ApiClient\Methods\Booking\AdditionalField;
use TrekkConnect\Sdk\ApiClient\Methods\Booking\Addon;

$credentials = new Credentials(
    getenv('API_PUBLIC_KEY'),
    getenv('API_SECRET_KEY')
);

$client = new Client($credentials);
$response = $client->booking()->create(
    new CommitBookingRequest(
      'sup_16648235-3751-4dbd-a3fd-81470fd913d3',
      'boo_8dd17a9e-17f4-4e6f-a5c4-dca7682c8321',
      '4434531234354',
      'Some special requirements',
      new Payment('50', 'USD'),
      new Contact('John Doe', 'john.doe@example.com', '+474998799654'),
       [
          new BookingItem(
              'act_28f8a3d7-611d-47a2-a34c-16cc780745de',
              'opt_f4e6624b-75c8-43f9-b9f7-06200acc59c5',
              '2019-05-30',
              [
                  new TicketCategory('8892762', 1, 'ext_1')
              ],
              [
                  new Guest(
                      'John',
                      'Doe',
                      'johndoe@example.com',
                      '+12345678901',
                      [
                          new AdditionalField('gender', 'm'),
                          new AdditionalField('nationality', 'CH'),
                      ],
                      [
                          new Addon('44267', 2),
                      ]
                  )
              ],
              [
                  new Addon('44268', 5),
              ]
          )
       ]
    )
);

Example Response

{
    "jsonrpc": "2.0",
    "result": {
        "bookingId": "boo_8dd17a9e-17f4-4e6f-a5c4-dca7682c8321",
        "tickets": [
            {
                "ticketId": "tic_06ed5e8e-f638-47b5-ac02-b829d82f3476",
                "ticketCategory": "8892762"
            }
        ]
    },
    "id": 1
}

Example Error Response

{
    "jsonrpc": "2.0",
    "error": {
        "code": 400,
        "message": "Request validation failed: contact.emailAddress:required, contact:type, contact:oneOf",
        "data": {
            "errors": {
                "contact.emailAddress": "The property emailAddress is required",
                "contact": "Failed to match exactly one schema"
            }
        }
    },
    "id": 1
}

Method

booking.commit

Params

Name Type Required Description
supplierId
string
yes Supplier Id
bookingId string yes Booking Id from the 1st step of booking process
externalBookingReference string yes Booking Reference from Distributor side
notes string yes Booking notes
bookingItems array yes Array of Booking Items
  activityId string yes Activity Id
  optionId string yes Option Id
  date string yes Local date. Must have YYYY-MM-DD format. More details
  ticketCategories array yes Array of Ticket Categories. Cannot be empty
    ticketCategory string yes Ticket Category id
    count integer yes Ticket Category count. For ticket categories which are not GROUP you should send them with count: 1. So if you have 5 Adult which are not GROUP you should send 5 ticket categories with count: 1. In case of GROUP ticket category you can pass count more than 1 like count: 5
    externalTicketId string, null yes Ticket Id on Distributor side. Can be null
  guests array yes Array of Guests. Cannot be empty
    firstName string, null yes Guest first name. Can be null
    lastName string, null yes Guest last name. Can be null
    emailAddress string, null yes Guest email address. Can be null
    phoneNumber string, null yes Guest phone number. Can be null
    addons array yes Array of addons. Can be empty []
      id string yes Addon Id
      quantity integer yes Addon Quantity
    additionalFields array yes Array of Additional Fields. Can be empty []
      key string yes Additional Field key
      value string yes Additional Field value
payment object, null yes Payment Info. Can be null if no payment info
  amount string yes Payment amount
  currency string yes Payment currency
contact object, null yes Contact Info. Can be null if no contact info
  fullName string, null yes Contact person full name. Can be null
  emailAddress string, null yes Contact person email address. Can be null
  phoneNumber string, null yes Contact person phone number. Can be null

Result

Name Type Description
bookingId
string
Booking Id
tickets array Array of tickets data
  ticketId string ExperienceBank ticket id
  ticketCategory string Requested ticket category

Error

Name Type Description
code integer Error code. See JSON RPC Specification
message string Error message
data object Error details if available
  errors object Errors key-value object. See example for more details

Cancel Booking

Example Request

{ 
  "jsonrpc": "2.0",
  "method": "booking.cancel",
  "params": {
    "bookingId" : "boo_d98b3525-2e76-4280-8b78-8c6a13dd6822",
    "reason": "cancellation reason",
    "note": "cancellation note"
  },
  "id": 1
}

use TrekkConnect\Sdk\ApiClient\Client;
use TrekkConnect\Sdk\ApiClient\Credentials;
use TrekkConnect\Sdk\ApiClient\Methods\Booking\CancelBookingRequest;

$credentials = new Credentials(
    getenv('API_PUBLIC_KEY'),
    getenv('API_SECRET_KEY')
);

$client = new Client($credentials);
$response = $client->booking()->cancel(
    new CancelBookingRequest(
      'boo_d98b3525-2e76-4280-8b78-8c6a13dd6822',
      'cancellation reason',
      'cancellation note'
    )
);

Example Response

{
    "jsonrpc": "2.0",
    "result": {},
    "id": 1
}

Example Error Response

{
    "jsonrpc": "2.0",
    "error": {
        "code": 400,
        "message": "Request validation failed: bookingId:minLength",
        "data": {
            "errors": {
                "bookingId": "Must be at least 1 characters long"
            }
        }
    },
    "id": 1
}

Method

booking.cancel

Params

Name Type Required Description
bookingId
string yes BookingId
reason string, null yes Cancellation reason. Can be empty or null
note string, null yes Cancellation note. Can be empty or null

Result

Name Type Description

Error

Name Type Description
code integer Error code. See JSON RPC Specification
message string Error message
data object Error details if available
  errors object Errors key-value object

Glossary

Processes

Partner Integration

Distributor Integration