Add Booking


Create new ATC booking record. As result of this request you will receive hash-key, that later can be used to delete booking record if needed.

Output fields:

  • hash: hash-code that identifies your booking record
  • id: booking record ID internal to API
  • result: result of booking operation. Can be either "OK" or "ERROR"
  • msg: field will appear once some error happened due booking operation and will contain description of that error

Usage

Endpoint: /booking

Request method: POST

Headers:

Header parameterDescription
X-API-Key Your unique API key
Content-Type This required to be set to application/x-www-form-urlencoded

Payload:

KeyValue description
cid VATSIM ID of controller that will provide service
pos ATC position name. Only DEL/GND/TWR/APP/CTR/FSS is allowed. Also position name should comply with VATSIM position naming rules and pass the check with ^[A-Z]([A-Z0-9]{1,3})(_[A-Z0-9])?_(DEL|GND|TWR|APP|CTR|FSS)$ regex rule. Max length - 10 characters.
from Booking start time in format 'YYYY-MM-DD HH:MM:SS'
to Booking end time in format 'YYYY-MM-DD HH:MM:SS'

Example request:

Python

    import requests

    url = "https://api.vacc-ua.org/api/booking"

    payload = "cid=1300518&pos=UKBB_GND&from=2018-05-03%2019%3A00%3A00&to=2018-05-03%2020%3A00%3A00"
    headers = {
        'X-API-Key': "123456",
        'Content-Type': "application/x-www-form-urlencoded",
        'Cache-Control': "no-cache"
    }

    response = requests.request("POST", url, data=payload, headers=headers)
    print(response.text)

PHP

    <?php

    $curl = curl_init();

    curl_setopt_array($curl, array(
        CURLOPT_PORT => "443",
        CURLOPT_URL => "https://api.vacc-ua.org/api/booking",
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "POST",
        CURLOPT_POSTFIELDS => "cid=1300518&pos=UKBB_GND&from=2018-05-03%2019%3A00%3A00&to=2018-05-03%2020%3A00%3A00",
        CURLOPT_HTTPHEADER => array(
            "Cache-Control: no-cache",
            "Content-Type: application/x-www-form-urlencoded",
            "X-API-Key: 123456"
        ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
        echo "cURL Error #:" . $err;
    } else {
        echo $response;
    }

Example response:


{
    "hash": "9953f98f9bfa1e547eedc156f0bb34f15a800b943a8f008ec267fbf0b438f109",
    "id": 1234,
    "result": "OK"
}