Takyon API
  • Takyon API integration
    • Get your API Key
    • Create / Update Booking [HOTEL]
    • Create / Update Booking [EXPERIENCE]
    • Create / Update Booking [TRIPS]
    • Create / Update Booking [RESTAURANT]
    • Retreive Booking Updates
  • Information script tag integration (optional)
    • Add the script to your website
  • Endpoints & Links
  • Need Help?
Powered by GitBook
On this page
  • Booking NFT Creation Request
  • Update an existent booking
  1. Takyon API integration

Create / Update Booking [RESTAURANT]

Booking NFT Creation Request

To make your first request, send an authenticated request to the endpoint. This will create a Booking NFT.

Take a look at how you might call this method using the technology of your choice:

const URI = "https://staging-api.takyon.io/v2";

const nftdata = {
  collectionId: "ce2bb8e9-ffde-4138-bc3a-bb00b879e9ec", // or your internal ID
  owner: "cody.martin@gmail.com",
  originalPrice: 599,
  images: [
    "https://www.yourhosting.com/image.png",
    "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAADHQA...",
  ],
  lockDate: "2023-02-14T22:59:00.000Z",
  guests: [
    {
      firstName: "Cody",
      secondName: "Martin",
      email: "cody.martin@gmail.com",
    },
    {
      firstName: "Zac",
      secondName: "Martin",
      email: "zac.martin@gmail.com",
    },
  ],
  lang: "en",
  payload: {
    type: "restaurant",
    restaurant: "Taste Bistro",
    cuisine: "French",
    email: "info@tastebistro.com",
    website: "https://tastebistro.com",
    note: "Include additional information about the restaurant here",
    location: {
      label: "123 Main Street, Anytown, USA",
      value: {
        description: "123 Main Street, Anytown, USA",
        matched_substrings: [{ length: 12, offset: 0 }],
        place_id: "ChIJRQNO6FIUhYgRqvgqaujHZgE",
        reference: "ChIJRQNO6FIUhYgRqvgqaujHZgE",
        structured_formatting: {
          main_text: "123 Main Street",
          main_text_matched_substrings: [{ length: 12, offset: 0 }],
          secondary_text: "Anytown, USA",
        },
        terms: [
          { offset: 0, value: "123 Main Street" },
          { offset: 17, value: "Anytown" },
          { offset: 26, value: "USA" },
        ],
        types: ["route", "geocode"],
      },
    },
    reference: "y789012",
    reservationTime: "2023-03-10T19:30:00.000Z",
    partySize: 4,
    specialRequests: "Vegetarian, gluten-free",
    occasion: "Anniversary",
    michelinStars: 2,
    dressCode: "Business Casual",
    reservationConfirmed: true,
    parking: "Valet Parking Available",
    chefsSpecialties: "Truffle Risotto, Grilled Sea Bass",
    wineList: "Extensive selection of local and international wines",
    tableType: "Window-side",
    extra: "Include additional information about the reservation here",
  },
};

const apikey = "1fed1306-3645-42d0-97d5-a39afa3195fa";

(async () => {
  const rawRes = await fetch(URI + "/nft", {
    method: "post",
    headers: {
      "Content-Type": "application/json",
      API_KEY: apikey,
    },
    body: JSON.stringify(nftdata),
  });

  const res = await rawRes.json();

  console.log(JSON.stringify(res));
})();

To avoid saving the Takyon collection ID in your systems you can set a custom ALIAS in /account/developer.

PARAMETER
DESCRIPTION
TYPE
REQUIRED

collectionId

Id of the collection (takyon ID or the id from your database, you can set up your own ID from the Takyon Dashboard)

string

yes

owner

email of the first owner of the NFT

string

yes

originalPrice

price of the Booking

number

yes

images

List of images (links to your hosting or raw data of the image)

array of strings

no

lockDate

Lock date of the NFT (most likely 23:59 of the day before the reservation)

ISOdate as string

yes

guests

List of guests

array of guests (firstName, secondName, email)

no

lang

Language of customer

Enum: "en" or "it"

no

payload.type

Type of the payload

"restaurant"

yes

payload.restaurant

Name of the Restaurant

string

no

payload.cuisine

Restaurant cousine

string

no

payload.email

Contact email of the Restaurant

string

no

payload.website

Website of the Restaurant

string

no

payload.note

Extra information about the Restaurant

string

no

payload.location

Location object from google API

Google Location Object

no

payload.reference

Reference of the reservation

string

yes

payload.reservationTime

Reservation time

ISOdate as string

yes

payload.tableType

Reservation table

string

no

payload.partySize

Number of guests

number

yes

payload.specialRequests

Guests requests

string

no

payload.occasion

Occasion of the reservation

string

no

payload.michelinStars

Michelin stars

number

no

payload.dressCode

Dress code

string

no

payload.parking

Parking info

string

no

payload.chefsSpecialties

Chef specialities

string

no

payload.wineList

Wine info

string

no

payload.extra

Extra information about the reservation

string

no

Keep note that the payload is customizable. We recommend using the structure provided in this example, but is possible to add information with custom keys or avoid some of the fields.

You might want to omit some of the fields of the payload (ex Restaurant Name, location, website ...), since this information will be customizable directly by the Restaurant in the Takyon dashboard and automatically placed inside the reservation.

Update an existent booking

You can update a Booking NFT simply by calling the Create Endpoint and adding "_id" as a parameter of the nftData. You'll get it in the response of the Create Endpoint, after the creation call, and you can store it in your systems. Alternatively, if you don't want to save the "_id" you can also use the same "payload.reference".

PreviousCreate / Update Booking [TRIPS]NextRetreive Booking Updates

Last updated 1 year ago