Developer Center

Getting started - Overview


Welcome to our Developer Portal. This portal provides information about all of our API endpoints as well as integration guides for common use cases. If you have any questions, don't hesitate to contact us. We will respond as soon as possible.

TicketSonic exposes REST APIs which provide an easy-to-use services, designed for our customers. These APIs enable the management of tickets, events, orders and ticket validation. We provide a wide array of configurations to support your unique business model and use case, and we work closely with you to ensure our APIs are addressing your every need.

This section describes the main steps involved in getting started with TicketSonic.


Step 1: Create an Account With TicketSonic

First, request a new account HERE. TicketSonic will set up your new account and on your account page HERE you will be able to see the credentials required to make request to TicketSonic API

Step 2: Connect to the API

Before you can submit a request and test the API, you need to obtain an API key which will be included in the header of your requests. After your account is activated your API key will be available HERE

Step 3: Build the Request Header

There are expected values which are required in the header of each request you submit to the TicketSonic API. These include the API key created during after user activation and your API ID. There are other values which can also be used in a request header. For more information, refer to the section on Request Headers. You may also find it useful to reference the section on Error Codes.

Step 4: Submit Your API Request

To learn how to submit your first request to the TicketSonic API, refer to the Code section available on every request help subsection. Those sections describe how to perform the discussed requests.

Step 5: Explore the API

While our guides will help you understand common use cases, we understand that everyone's cases are unique. Explore our API Reference to see how TicketSonic API can work for you and how you can tailor the API to your needs. In case you need specific functionality don't hesitate to contact us.


Request Headers

Most of TicketSonic APIs require the following common request headers. In some cases, additional headers may be required or optionally available. Please refer to the reference guides for the specific endpoints you are interacting with.

X-Api-UserID string

The API UserID header contains the contents of your unique User ID assigned to you upon activation. Its purpose is to identify who is issuing the request.

X-API-Key string

The API Key header contains a sequence of characters forming a unique string. Its purpose is to serve as a key when issuing requests.

X-API-EventID string

The API EventID header contains the event ID of an event that needs to be addressed. It is only required when requesting event related operations.

X-API-SKU string

The API SKU header contains the SKU unique ID of an ticket that needs to be addressed. It is only requred when requesting ticket related operations.


Request Body Fields

The Request Body is built by constructing a JSON object via a sequence of the following fields.

primary_text_pl string

A primary text in primary language. This field is typically used to set or edit the title of a ticket or an event in its primary language.

primary_text_sl string

A primary text in secondary language. This field is typically used to set or edit the title of a ticket or an event in its secondary language in case of a multilingual ticket or event.

secondary_text_pl string

A secondary text in primary language. This field is typically used to set or edit the description of a ticket or an event in its primary language.

secondary_text_sl string

A secondary text in secondary language. This field is typically used to set or edit the description of a ticket or an event in its secondary language in case of a multilingual ticket or event.

start_datetime unix timestamp

A field for storing the start date time of a ticket or an event. A typical scenario to set this field is when issuing tickets with limited time validity.

location string

A field for storing the location of a ticket or an event. A typical scenario to set this field is when issuing tickets with limited set of location where they are valid.

price integer

A field for setting ticket price.

Allowed values: price >= 0
currency string

A field for setting the currency of the price of the ticket.

Allowed values: EUR, USD, GBP, BGN
stock integer

The stock availability of the ticket.

Allowed values: stock >= 0

Error Codes

400 unknown user Bad Request

Wrong X-Api-UserID value in the headers was provided.

400 unknown key Bad Request

Wrong X-API-Key value in the headers was provided.

400 invalid stock or sku Bad Request

Invalid sku used or insufficient stock was requested.

400 event ownership verification failure Bad Request

Wrong X-API-EventID value in the headers was provided.

400 ticket ownership verification failure Bad Request

Wrong X-API-SKU value in the headers was provided.

400 duplicated request Bad Request

Non unique request hash was provided.

400 invalid event id Bad Request

Wrong X-API-EventID value in the headers was provided.

500 error fetching data Internal Server Error

Error when processing the data.


Tickets API

The following Tickets API is responsible for handling tickets. You can request new tickets, changes in existing ones, listing and validation of already issued tickets.

List Tickets

Ticket listing request is done via the following REST API request. There are several required headers and several required and optional JSON fields that have to be set in the JSON body of the request.

Headers

X-Api-UserID string Required

The UserID.

X-Api-Key string Required

The User API Key.

X-Api-EventID string Optional

The API EventID header contains the event ID of an event that needs to be addressed. If the header is present only the tickets associated to the event will be returned. Otherwise all tickets will be returned.

Responses

200 Success

The request have been successfully sent.

500 error fetching data Internal Server Error

Error when processing the data.

Code

GET /v1/ticket/list HTTP/1.1
Host: https://www.ticketsonic.com:9507
X-Api-UserID: test1@ticketsonic.com
X-API-Key: e059d2930e8be29314e323040c0cd2f6
                                                

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://www.ticketsonic.com:9507/v1/ticket/list");
xhr.setRequestHeader("X-Api-UserID", "test1@ticketsonic.com");
xhr.setRequestHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6");

xhr.send();
                                                
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'https://www.ticketsonic.com',
  'port': 9507,
  'path': '/v1/ticket/list',
  'headers': {
    'X-Api-UserID': 'test1@ticketsonic.com',
    'X-API-Key': 'e059d2930e8be29314e323040c0cd2f6'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
                                                
setRequestUrl('https://www.ticketsonic.com:9507/v1/ticket/list');
$request->setRequestMethod('GET');
$request->setOptions(array());
$request->setHeaders(array(
  'X-Api-UserID' => 'test1@ticketsonic.com',
  'X-API-Key' => 'e059d2930e8be29314e323040c0cd2f6'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();

                                                
var client = new RestClient("https://www.ticketsonic.com:9507/v1/ticket/list");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("X-Api-UserID", "test1@ticketsonic.com");
request.AddHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
                                                
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("https://www.ticketsonic.com:9507/v1/ticket/list")
  .method("GET", null)
  .addHeader("X-Api-UserID", "test1@ticketsonic.com")
  .addHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6")
  .build();
Response response = client.newCall(request).execute();
                                                
require "uri"
require "net/http"

url = URI("https://www.ticketsonic.com:9507/v1/ticket/list")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)
request["X-Api-UserID"] = "test1@ticketsonic.com"
request["X-API-Key"] = "e059d2930e8be29314e323040c0cd2f6"

response = http.request(request)
puts response.read_body
                                                

Response

{
    "status": "success",
    "user_public_key": "user_public_key",
    "tickets": [
        {
            "sku": "815-46527",
            "price": "250.00",
            "currency": "USD",
            "stock": 150,
            "secondary_text_sl": "Descripción del pase normal",
            "secondary_text_pl": "Regular pass description",
            "primary_text_sl": "Pase Normal",
            "primary_text_pl": "Regular Pass",
            "event_id": "3685246"
        },
        {
            "sku": "815-46528",
            "price": "280.50",
            "currency": "EUR",
            "stock": 250,
            "secondary_text_sl": "Descripción del pase normal",
            "secondary_text_pl": "Regular pass description",
            "primary_text_sl": "Pase Normal",
            "primary_text_pl": "Regular Pass",
            "event_id": "3685246"
        }
    ]
}
                                        

Create Ticket

Ticket creation is done via the following REST API request. There are several required headers and several required and optional JSON fields that have to be set in the JSON body of the request.

Headers

X-Api-UserID string Required

The UserID.

X-API-Key string Required

The User API Key.

X-API-EventID string Required

The unique identifier of the event that the ticket have to be set.

Request Body

request_hash string Required

Random sequence of characters for extra request security.

primary_text_pl string Required

The title of the ticket in its primary language.

primary_text_sl string Optional

The title of the ticket in its secondary language.

secondary_text_pl string Optional

The description of the ticket in its primary language.

secondary_text_sl string Optional

The description of the ticket in its secondary language.

start_datetime unix timestamp Optional

In case the ticket is limited within a time period this field have to be set.

location string Optional

In case the ticket is limited within a location ot set of locations this field have to be set.

price integer Required

The price of the ticket.

Allowed values: price >= 0
currency string Required

A field for setting the currency of the price of the ticket.

Allowed values: EUR, USD, GBP, BGN
stock integer Required

The stock availability of the ticket.

Allowed values: stock >= 0

Responses

200 Success

The request have been successfully sent.

400 duplicated request Bad Request

The request_hash value is not unique.

400 unknown user Bad Request

Wrong X-Api-UserID value in the headers was provided.

400 unknown key Bad Request

Wrong X-API-Key value in the headers was provided.

400 invalid event id Bad Request

Wrong X-API-EventID value in the headers was provided.

Code

POST /v1/ticket/new HTTP/1.1
Host: https://www.ticketsonic.com:9507
X-Api-UserID: test1@ticketsonic.com
X-API-Key: e059d2930e8be29314e323040c0cd2f6
X-API-EventID: 3685246
Content-Type: application/json
Content-Length: 374

{
    "primary_text_pl": "Regular Pass",
    "primary_text_sl": "Pase Normal",
    "secondary_text_pl": "Regular pass description",
    "secondary_text_sl": "Descripción del pase normal",
    "start_datetime" : 1614791561,
    "location" : "Los Angeles",
    "price" : 250,
    "currency" : "USD",
    "stock" : 150,
    "request_hash" : "003ee10837c54e7df16801537393a115"
}
                                            
var data = JSON.stringify({
  "primary_text_pl": "Regular Pass",
  "primary_text_sl": "Pase Normal",
  "secondary_text_pl": "Regular pass description",
  "secondary_text_sl": "Descripción del pase normal",
  "start_datetime": 1614791561,
  "location": "Los Angeles",
  "price": 250,
  "currency": "USD",
  "stock": 150,
  "request_hash": "003ee10837c54e7df16801537393a115"
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://www.ticketsonic.com:9507/v1/ticket/new");
xhr.setRequestHeader("X-Api-UserID", "test1@ticketsonic.com");
xhr.setRequestHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6");
xhr.setRequestHeader("X-API-EventID", "3685246");
xhr.setRequestHeader("Content-Type", "application/json");

xhr.send(data);
                                            
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'POST',
  'hostname': 'https://www.ticketsonic.com',
  'port': 9507,
  'path': '/v1/ticket/new',
  'headers': {
    'X-Api-UserID': 'test1@ticketsonic.com',
    'X-API-Key': 'e059d2930e8be29314e323040c0cd2f6',
    'X-API-EventID': '3685246',
    'Content-Type': 'application/json'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData = JSON.stringify({
  "primary_text_pl": "Regular Pass",
  "primary_text_sl": "Pase Normal",
  "secondary_text_pl": "Regular pass description",
  "secondary_text_sl": "Descripción del pase normal",
  "start_datetime": 1614791561,
  "location": "Los Angeles",
  "price": 250,
  "currency": "USD",
  "stock": 150,
  "request_hash": "003ee10837c54e7df16801537393a115"
});

req.write(postData);

req.end();
                                            
setRequestUrl('https://www.ticketsonic.com:9507/v1/ticket/new');
$request->setRequestMethod('POST');
$body = new http\Message\Body;
$body->append('{
    "primary_text_pl": "Regular Pass",
    "primary_text_sl": "Pase Normal",
    "secondary_text_pl": "Regular pass description",
    "secondary_text_sl": "Descripción del pase normal",
    "start_datetime" : 1614791561,
    "location" : "Los Angeles",
    "price" : 250,
    "currency" : "USD",
    "stock" : 150,
    "request_hash" : "003ee10837c54e7df16801537393a115"
}');
$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
  'X-Api-UserID' => 'test1@ticketsonic.com',
  'X-API-Key' => 'e059d2930e8be29314e323040c0cd2f6',
  'X-API-EventID' => '3685246',
  'Content-Type' => 'application/json'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();

                                            
var client = new RestClient("https://www.ticketsonic.com:9507/v1/ticket/new");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("X-Api-UserID", "test1@ticketsonic.com");
request.AddHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6");
request.AddHeader("X-API-EventID", "3685246");
request.AddHeader("Content-Type", "application/json");
var body = @"{" + "\n" +
@"    ""primary_text_pl"": ""Regular Pass""," + "\n" +
@"    ""primary_text_sl"": ""Pase Normal""," + "\n" +
@"    ""secondary_text_pl"": ""Regular pass description""," + "\n" +
@"    ""secondary_text_sl"": ""Descripción del pase normal""," + "\n" +
@"    ""start_datetime"" : 1614791561," + "\n" +
@"    ""location"" : ""Los Angeles""," + "\n" +
@"    ""price"" : 250," + "\n" +
@"    ""currency"" : ""USD""," + "\n" +
@"    ""stock"" : 150," + "\n" +
@"    ""request_hash"" : ""003ee10837c54e7df16801537393a115""" + "\n" +
@"}";
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
                                            
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"primary_text_pl\": \"Regular Pass\",\n    \"primary_text_sl\": \"Pase Normal\",\n    \"secondary_text_pl\": \"Regular pass description\",\n    \"secondary_text_sl\": \"Descripción del pase normal\",\n    \"start_datetime\" : 1614791561,\n    \"location\" : \"Los Angeles\",\n    \"price\" : 250,\n    \"currency\" : \"USD\",\n    \"stock\" : 150,\n    \"request_hash\" : \"003ee10837c54e7df16801537393a115\"\n}");
Request request = new Request.Builder()
  .url("https://www.ticketsonic.com:9507/v1/ticket/new")
  .method("POST", body)
  .addHeader("X-Api-UserID", "test1@ticketsonic.com")
  .addHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6")
  .addHeader("X-API-EventID", "3685246")
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();
                                            
require "uri"
require "json"
require "net/http"

url = URI("https://www.ticketsonic.com:9507/v1/ticket/new")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["X-Api-UserID"] = "test1@ticketsonic.com"
request["X-API-Key"] = "e059d2930e8be29314e323040c0cd2f6"
request["X-API-EventID"] = "3685246"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
  "primary_text_pl": "Regular Pass",
  "primary_text_sl": "Pase Normal",
  "secondary_text_pl": "Regular pass description",
  "secondary_text_sl": "Descripción del pase normal",
  "start_datetime": 1614791561,
  "location": "Los Angeles",
  "price": 250,
  "currency": "USD",
  "stock": 150,
  "request_hash": "003ee10837c54e7df16801537393a1a5"
})

response = http.request(request)
puts response.read_body

                                            

Response

{
    "status": "success"
}
                                    

Edit Ticket

Ticket edit request is done via the following REST API request. There are several required headers and several required and optional JSON fields that have to be set in the JSON body of the request.

You may add only the fields you need to be edited.

Headers

X-Api-UserID string Required

The UserID.

X-API-Key string Required

The User API Key.

X-API-SKU string Required

The unique identifier of the ticket that have to be altered.

Request Body

request_hash string Required

Random sequence of characters for extra request security.

primary_text_pl string Optional

The title of the ticket in its primary language.

primary_text_sl string Optional

The title of the ticket in its secondary language.

secondary_text_pl string Optional

The description of the ticket in its primary language.

secondary_text_sl string Optional

The description of the ticket in its secondary language.

start_datetime unix timestamp Optional

The start date time of the validity of the ticket.

location string Optional

The location where the ticket is valid.

price integer Optional

The price of the ticket.

Allowed values: price >= 0
currency string Optional

A field for setting the currency of the price of the ticket.

Allowed values: EUR, USD, GBP, BGN
stock integer Optional

The stock availability of the ticket.

Allowed values: stock >= 0

Responses

200 Success

The request have been successfully sent.

400 unknown user Bad Request

Wrong X-Api-UserID value in the headers was provided.

400 unknown key Bad Request

Wrong X-API-Key value in the headers was provided.

400 ticket ownership verification failure Bad Request

Wrong X-API-SKU value in the headers was provided.

Code

POST /v1/ticket/edit HTTP/1.1
Host: https://www.ticketsonic.com:9507
X-Api-UserID: test1@ticketsonic.com
X-API-Key: e059d2930e8be29314e323040c0cd2f6
X-API-SKU: 815-46528
Content-Type: application/json
Content-Length: 377

{
    "primary_text_pl": "Regular Pass",
    "primary_text_sl": "Pase Normal",
    "secondary_text_pl": "Regular pass description",
    "secondary_text_sl": "Descripción del pase normal",
    "start_datetime" : 1614791561,
    "location" : "Los Angeles",
    "price" : 280.50,
    "currency" : "EUR",
    "stock" : 250,
    "request_hash" : "003ee10837c54e7df16801537393a116"
}
                                                
var data = JSON.stringify({
  "primary_text_pl": "Regular Pass",
  "primary_text_sl": "Pase Normal",
  "secondary_text_pl": "Regular pass description",
  "secondary_text_sl": "Descripción del pase normal",
  "start_datetime": 1614791561,
  "location": "Los Angeles",
  "price": 280.5,
  "currency": "EUR",
  "stock": 250,
  "request_hash": "003ee10837c54e7df16801537393a116"
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://www.ticketsonic.com:9507/v1/ticket/edit");
xhr.setRequestHeader("X-Api-UserID", "test1@ticketsonic.com");
xhr.setRequestHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6");
xhr.setRequestHeader("X-API-SKU", "815-46528");
xhr.setRequestHeader("Content-Type", "application/json");

xhr.send(data);
                                                
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'POST',
  'hostname': 'https://www.ticketsonic.com',
  'port': 9507,
  'path': '/v1/ticket/edit',
  'headers': {
    'X-Api-UserID': 'test1@ticketsonic.com',
    'X-API-Key': 'e059d2930e8be29314e323040c0cd2f6',
    'X-API-SKU': '815-46528',
    'Content-Type': 'application/json'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData = JSON.stringify({
  "primary_text_pl": "Regular Pass",
  "primary_text_sl": "Pase Normal",
  "secondary_text_pl": "Regular pass description",
  "secondary_text_sl": "Descripción del pase normal",
  "start_datetime": 1614791561,
  "location": "Los Angeles",
  "price": 280.5,
  "currency": "EUR",
  "stock": 250,
  "request_hash": "003ee10837c54e7df16801537393a116"
});

req.write(postData);

req.end();
                                                
setRequestUrl('https://www.ticketsonic.com:9507/v1/ticket/edit');
$request->setRequestMethod('POST');
$body = new http\Message\Body;
$body->append('{
    "primary_text_pl": "Regular Pass",
    "primary_text_sl": "Pase Normal",
    "secondary_text_pl": "Regular pass description",
    "secondary_text_sl": "Descripción del pase normal",
    "start_datetime" : 1614791561,
    "location" : "Los Angeles",
    "price" : 280.50,
    "currency" : "EUR",
    "stock" : 250,
    "request_hash" : "003ee10837c54e7df16801537393a116"
}');
$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
  'X-Api-UserID' => 'test1@ticketsonic.com',
  'X-API-Key' => 'e059d2930e8be29314e323040c0cd2f6',
  'X-API-SKU' => '815-46528',
  'Content-Type' => 'application/json'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();

                                                
var client = new RestClient("https://www.ticketsonic.com:9507/v1/ticket/edit");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("X-Api-UserID", "test1@ticketsonic.com");
request.AddHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6");
request.AddHeader("X-API-SKU", "815-46528");
request.AddHeader("Content-Type", "application/json");
var body = @"{" + "\n" +
@"    ""primary_text_pl"": ""Regular Pass""," + "\n" +
@"    ""primary_text_sl"": ""Pase Normal""," + "\n" +
@"    ""secondary_text_pl"": ""Regular pass description""," + "\n" +
@"    ""secondary_text_sl"": ""Descripción del pase normal""," + "\n" +
@"    ""start_datetime"" : 1614791561," + "\n" +
@"    ""location"" : ""Los Angeles""," + "\n" +
@"    ""price"" : 280.50," + "\n" +
@"    ""currency"" : ""EUR""," + "\n" +
@"    ""stock"" : 250," + "\n" +
@"    ""request_hash"" : ""003ee10837c54e7df16801537393a116""" + "\n" +
@"}";
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
                                                
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"primary_text_pl\": \"Regular Pass\",\n    \"primary_text_sl\": \"Pase Normal\",\n    \"secondary_text_pl\": \"Regular pass description\",\n    \"secondary_text_sl\": \"Descripción del pase normal\",\n    \"start_datetime\" : 1614791561,\n    \"location\" : \"Los Angeles\",\n    \"price\" : 280.50,\n    \"currency\" : \"EUR\",\n    \"stock\" : 250,\n    \"request_hash\" : \"003ee10837c54e7df16801537393a116\"\n}");
Request request = new Request.Builder()
  .url("https://www.ticketsonic.com:9507/v1/ticket/edit")
  .method("POST", body)
  .addHeader("X-Api-UserID", "test1@ticketsonic.com")
  .addHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6")
  .addHeader("X-API-SKU", "815-46528")
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();
                                                
require "uri"
require "json"
require "net/http"

url = URI("https://www.ticketsonic.com:9507/v1/ticket/edit")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["X-Api-UserID"] = "test1@ticketsonic.com"
request["X-API-Key"] = "e059d2930e8be29314e323040c0cd2f6"
request["X-API-SKU"] = "815-46528"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
  "primary_text_pl": "Regular Pass",
  "primary_text_sl": "Pase Normal",
  "secondary_text_pl": "Regular pass description",
  "secondary_text_sl": "Descripción del pase normal",
  "start_datetime": 1614791561,
  "location": "Los Angeles",
  "price": 280.5,
  "currency": "EUR",
  "stock": 250,
  "request_hash": "003ee10837c54e7df16801537393a116"
})

response = http.request(request)
puts response.read_body

                                                

Response

{
    "status": "success"
}
                                        

Ticket Validation

Ticket validation request is done via the following REST API request. There are several required headers and several required and optional JSON fields that have to be set in the JSON body of the request.

Headers

X-Api-UserID string Required

The UserID.

X-Api-Key string Required

The User API Key.

Request Body

ticket_sensitive string Required

The QR value of the ticket.

Responses

200 success

The ticket is valid.

200 failure

The ticket is invalid.

400 unknown user Bad Request

Wrong X-Api-UserID value in the headers was provided.

400 unknown key Bad Request

Wrong X-API-Key value in the headers was provided.

400 invalid sensitive Bad Request

Invalid ticket_sensitive value in the body was provided.

Code

POST /v1/ticket/validate HTTP/1.1
Host: https://www.ticketsonic.com:9507
X-Api-UserID: test1@ticketsonic.com
X-API-Key: e059d2930e8be29314e323040c0cd2f6
Content-Type: application/json
Content-Length: 119

{
    "ticket_sensitive" : "Db5hI0T58SUbYblB5gfOJDlsobuFylFsg/n9KFmEe5bnZWR7gVnvXkW0wzPb8tVF7ss8Xet62payWV5l0sDH9w=="
}
                                                
var data = JSON.stringify({
  "ticket_sensitive": "Db5hI0T58SUbYblB5gfOJDlsobuFylFsg/n9KFmEe5bnZWR7gVnvXkW0wzPb8tVF7ss8Xet62payWV5l0sDH9w=="
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://www.ticketsonic.com:9507/v1/ticket/validate");
xhr.setRequestHeader("X-Api-UserID", "test1@ticketsonic.com");
xhr.setRequestHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6");
xhr.setRequestHeader("Content-Type", "application/json");

xhr.send(data);
                                                
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'POST',
  'hostname': 'https://www.ticketsonic.com',
  'port': 9507,
  'path': '/v1/ticket/validate',
  'headers': {
    'X-Api-UserID': 'test1@ticketsonic.com',
    'X-API-Key': 'e059d2930e8be29314e323040c0cd2f6',
    'Content-Type': 'application/json'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData = JSON.stringify({
  "ticket_sensitive": "Db5hI0T58SUbYblB5gfOJDlsobuFylFsg/n9KFmEe5bnZWR7gVnvXkW0wzPb8tVF7ss8Xet62payWV5l0sDH9w=="
});

req.write(postData);

req.end();
                                                
setRequestUrl('https://www.ticketsonic.com:9507/v1/ticket/validate');
$request->setRequestMethod('POST');
$body = new http\Message\Body;
$body->append('{
    "ticket_sensitive" : "Db5hI0T58SUbYblB5gfOJDlsobuFylFsg/n9KFmEe5bnZWR7gVnvXkW0wzPb8tVF7ss8Xet62payWV5l0sDH9w=="
}');
$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
  'X-Api-UserID' => 'test1@ticketsonic.com',
  'X-API-Key' => 'e059d2930e8be29314e323040c0cd2f6',
  'Content-Type' => 'application/json'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();

                                                
var client = new RestClient("https://www.ticketsonic.com:9507/v1/ticket/validate");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("X-Api-UserID", "test1@ticketsonic.com");
request.AddHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6");
request.AddHeader("Content-Type", "application/json");
var body = @"{" + "\n" +
@"    ""ticket_sensitive"" : ""Db5hI0T58SUbYblB5gfOJDlsobuFylFsg/n9KFmEe5bnZWR7gVnvXkW0wzPb8tVF7ss8Xet62payWV5l0sDH9w==""" + "\n" +
@"}";
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
                                                
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"ticket_sensitive\" : \"Db5hI0T58SUbYblB5gfOJDlsobuFylFsg/n9KFmEe5bnZWR7gVnvXkW0wzPb8tVF7ss8Xet62payWV5l0sDH9w==\"\n}");
Request request = new Request.Builder()
  .url("https://www.ticketsonic.com:9507/v1/ticket/validate")
  .method("POST", body)
  .addHeader("X-Api-UserID", "test1@ticketsonic.com")
  .addHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6")
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();
                                                
require "uri"
require "json"
require "net/http"

url = URI("https://www.ticketsonic.com:9507/v1/ticket/validate")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["X-Api-UserID"] = "test1@ticketsonic.com"
request["X-API-Key"] = "e059d2930e8be29314e323040c0cd2f6"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
  "ticket_sensitive": "Db5hI0T58SUbYblB5gfOJDlsobuFylFsg/n9KFmEe5bnZWR7gVnvXkW0wzPb8tVF7ss8Xet62payWV5l0sDH9w=="
})

response = http.request(request)
puts response.read_body

                                                

Response

{
    "status": "success",
    "message": {
        "event_id": 2144799,
        "price": 150
    }
}
                                        

Events API

The following Events API is responsible for handling events. You can request new events, changes in existing ones and listing them.

List Events

Event listing request is done via the following REST API request. There are several required headers and several required and optional JSON fields that have to be set in the JSON body of the request.

Headers

X-Api-UserID string Required

The UserID.

X-API-Key string Required

The User API Key.

Responses

200 Success

The request have been successfully sent.

400 unknown user Bad Request

Wrong X-Api-UserID value in the headers was provided.

400 unknown key Bad Request

Wrong X-API-Key value in the headers was provided.

500 error fetching data Internal Server Error

Error when processing the data.

Code

GET /v1/event/list HTTP/1.1
Host: https://www.ticketsonic.com:9507
X-Api-UserID: test1@ticketsonic.com
X-API-Key: e059d2930e8be29314e323040c0cd2f6
                                                    

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://www.ticketsonic.com:9507/v1/event/list");
xhr.setRequestHeader("X-Api-UserID", "test1@ticketsonic.com");
xhr.setRequestHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6");

xhr.send();
                                                    
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'https://www.ticketsonic.com',
  'port': 9507,
  'path': '/v1/event/list',
  'headers': {
    'X-Api-UserID': 'test1@ticketsonic.com',
    'X-API-Key': 'e059d2930e8be29314e323040c0cd2f6'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
                                                    
setRequestUrl('https://www.ticketsonic.com:9507/v1/event/list');
$request->setRequestMethod('GET');
$request->setOptions(array());
$request->setHeaders(array(
  'X-Api-UserID' => 'test1@ticketsonic.com',
  'X-API-Key' => 'e059d2930e8be29314e323040c0cd2f6'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();

                                                    
var client = new RestClient("https://www.ticketsonic.com:9507/v1/event/list");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("X-Api-UserID", "test1@ticketsonic.com");
request.AddHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
                                                    
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("https://www.ticketsonic.com:9507/v1/event/list")
  .method("GET", null)
  .addHeader("X-Api-UserID", "test1@ticketsonic.com")
  .addHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6")
  .build();
Response response = client.newCall(request).execute();
                                                    
require "uri"
require "net/http"

url = URI("https://www.ticketsonic.com:9507/v1/event/list")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)
request["X-Api-UserID"] = "test1@ticketsonic.com"
request["X-API-Key"] = "e059d2930e8be29314e323040c0cd2f6"

response = http.request(request)
puts response.read_body

                                                    

Response

{
    "status": "success",
    "user_public_key": "user_public_key",
    "events": [
        {
            "secondary_text_sl": "Descripción de la exposición de dinosaurios",
            "secondary_text_pl": "Dinosaurs Exhibition Description",
            "primary_text_sl": "Exposición de dinosaurios",
            "primary_text_pl": "Dinosaurs Exhibition",
            "event_id": "4067610",
            "start_time": 1598989999,
            "end_time": null,
            "event_location": "Louvre, Hall 2",
            "badge": {
            "badge_size" : "A8",
            "badge_primary_text_horizontal_location" : "center",
            "badge_primary_text_horizontal_offset": 0,
            "badge_primary_text_vertical_location" : "center",
            "badge_primary_text_vertical_offset" : 0,
            "badge_primary_text_fontsize" : 70,
            "badge_primary_text_color" : "#444444",
            "badge_primary_test_text" : "FirstName LastName",
            "badge_primary_text_break_distance" : 0,
            "badge_secondary_text_horizontal_location" : "center",
            "badge_secondary_text_horizontal_offset": 0,
            "badge_secondary_text_vertical_location" : "center",
            "badge_secondary_text_vertical_offset" : 0,
            "badge_secondary_text_fontsize" : 70,
            "badge_secondary_text_color" : "#444444",
            "badge_secondary_test_text" : "My Company",
            "badge_secondary_text_break_distance" : 0
        }
    ]
}
                                            

Create Event

Event creation is done via the following REST API request. There are several required headers and several required and optional JSON fields that have to be set in the JSON body of the request.

Headers

X-Api-UserID string Required

The UserID.

X-API-Key string Required

The User API Key.

Request Body

request_hash string Required

Unique sequence of characters.

primary_text_pl string Required

The title of the event in its primary language.

primary_text_sl string Optional

The title of the event in its secondary language.

secondary_text_pl string Optional

The description of the event in its primary language.

secondary_text_sl string Optional

The description of the event in its secondary language.

start_datetime unix timestamp Optional

The event start time.

location string Optional

The event location.

Object Required

The object carrying information about the tickets.

primary_text_pl string Required

The title of the ticket in its primary language.

primary_text_sl string Optional

The title of the ticket in its secondary language.

secondary_text_pl string Optional

The description of the ticket in its primary language.

secondary_text_sl string Optional

The description of the ticket in its secondary language.

start_datetime unix timestamp Optional

In case the ticket is limited within a time period this field have to be set.

location string Optional

In case the ticket is limited within a location ot set of locations this field have to be set.

price integer Required

A field for setting ticket price.

Allowed values: price >= 0
currency string Required

A field for setting the currency of the price of the ticket.

Allowed values: EUR, USD, GBP, BGN
stock integer Required

The stock availability of the ticket.

Allowed values: stock >= 0
Object Required

The object carrying information about the badge.

badge_size string Optional

The physical badge size.

Allowed values: A4, A5, A6, A7, A8, A9, A19
Default: A6
badge_primary_text_horizontal_location string Optional

The horizontal location of the primary text on the badge.

Allowed values: left, center, right
Default: center
badge_primary_text_horizontal_offset integer Optional

The horizontal offset in percentages added to the badge_primary_text_horizontal_location value. For example if badge_primary_text_horizontal_location is set to "left" and badge_primary_text_horizontal_offset is set to 5 then the text will appear with 5% offset from the left border of the badge.

Allowed values: 0-100
Default: 0
badge_primary_text_vertical_location string Optional

The vertical location of the primary text on the badge.

Allowed values: top, center, bottom
Default: center
badge_primary_text_vertical_offset integer Optional

The vertical offset in percentages added to the badge_primary_text_vertical_location value. For example if badge_primary_text_vertical_location is set to "center" and badge_primary_text_vertical_offset is set to 5 then the text will appear 5% higher from the vertical center of the badge.

Allowed values: 0-100
Default: -4
badge_primary_text_fontsize integer Optional

The font size of the primary text on the badge.

Allowed values: badge_primary_text_fontsize > 0
Default: 30
badge_primary_text_color string Optional

The html color of the primary text on the badge.

Allowed values: HTML colors in the form of #000000
Default: #000000
badge_primary_test_text string Optional

The primary test text to serve as an example customer name on the badge.

Allowed values: strings
Default: FirstName LastName
badge_primary_text_break_distance integer Optional

Values greater than 0 break the text so that every word appears on a new line. The value controls the distance between the lines.

Allowed values: badge_primary_text_break_distance > 0
Default: 0
badge_secondary_text_horizontal_location string Optional

The horizontal location of the secondary text on the badge.

Allowed values: left, center, right
Default: center
badge_secondary_text_horizontal_offset integer Optional

The horizontal offset in percentages added to the badge_secondary_text_horizontal_location value. For example if badge_secondary_text_horizontal_location is set to "left" and badge_secondary_text_horizontal_offset is set to 5 then the text will appear with 5% offset from the left border of the badge.

Allowed values: 0-100
Default: 0
badge_secondary_text_vertical_location string Optional

The vertical location of the secondary text on the badge.

Allowed values: top, center, bottom
Default: center
badge_secondary_text_vertical_offset integer Optional

The vertical offset in percentages added to the badge_secondary_text_vertical_location value. For example if badge_secondary_text_vertical_location is set to "center" and badge_secondary_text_vertical_offset is set to 5 then the text will appear 5% higher from the vertical center of the badge.

Allowed values: 0-100
Default: -4
badge_secondary_text_fontsize integer Optional

The font size of the secondary text on the badge.

Allowed values: badge_secondary_text_fontsize > 0
Default: 30
badge_secondary_text_color string Optional

The html color of the secondary text on the badge.

Allowed values: HTML colors in the form of #000000
Default: #000000
badge_secondary_test_text string Optional

The secondary test text to serve as an example customer name on the badge.

Allowed values: strings
Default: FirstName LastName
badge_secondary_text_break_distance integer Optional

Values greater than 0 break the text so that every word appears on a new line. The value controls the distance between the lines.

Allowed values: badge_secondary_text_break_distance > 0
Default: 0

Responses

200 Success

The request have been successfully sent.

400 unknown user Bad Request

Wrong X-Api-UserID value in the headers was provided.

400 unknown key Bad Request

Wrong X-API-Key value in the headers was provided.

400 duplicated request Bad Request

Non unique hash was provided.

Code

POST /v1/event/new HTTP/1.1
Host: https://www.ticketsonic.com:9507
X-Api-UserID: test1@ticketsonic.com
X-API-Key: e059d2930e8be29314e323040c0cd2f6
Content-Type: application/json
Content-Length: 1305

{
    "primary_text_pl": "Dinosaurs Exhibition",
    "primary_text_sl": "Exposición de dinosaurios",
    "secondary_text_pl": "Dinosaurs Exhibition Description",
    "secondary_text_sl": "Descripción de la exposición de dinosaurios",
    "location": "Louvre",
    "start_datetime": "1598989999",
    "tickets" : [
        {
            "primary_text_pl": "Regular Pass",
            "primary_text_sl": "Pase Normal",
            "secondary_text_pl": "Regular pass description",
            "secondary_text_sl": "Descripción del pase normal",
            "price": 100,
            "currency": "USD",
            "stock": 500
        },
        {
            "primary_text_pl": "Children Pass",
            "primary_text_sl": "Pase de Niños",
            "secondary_text_pl": "Children Pass Description",
            "secondary_text_sl": "Descripción Pase Niños",
            "price": 20.50,
            "currency": "USD",
            "stock": 600
        }
    ],
    "badge" : {
        "badge_size" : "A8",
        "badge_primary_text_horizontal_location" : "center",
        "badge_primary_text_horizontal_offset": 0,
        "badge_primary_text_vertical_location" : "center",
        "badge_primary_text_vertical_offset" : 0,
        "badge_primary_text_fontsize" : 70,
        "badge_primary_text_color" : "#444444",
        "badge_primary_test_text" : "FirstName LastName",
        "badge_primary_text_break_distance" : 0,
        "badge_secondary_text_horizontal_location" : "center",
        "badge_secondary_text_horizontal_offset": 0,
        "badge_secondary_text_vertical_location" : "center",
        "badge_secondary_text_vertical_offset" : 0,
        "badge_secondary_text_fontsize" : 70,
        "badge_secondary_text_color" : "#444444",
        "badge_secondary_test_text" : "My Company",
        "badge_secondary_text_break_distance" : 0
    },
    "request_hash" : "003ee10837c54e7df16801537393a110"
}
                                                
var data = JSON.stringify({
  "primary_text_pl": "Dinosaurs Exhibition",
  "primary_text_sl": "Exposición de dinosaurios",
  "secondary_text_pl": "Dinosaurs Exhibition Description",
  "secondary_text_sl": "Descripción de la exposición de dinosaurios",
  "location": "Louvre",
  "start_datetime": "1598989999",
  "tickets": [
    {
      "primary_text_pl": "Regular Pass",
      "primary_text_sl": "Pase Normal",
      "secondary_text_pl": "Regular pass description",
      "secondary_text_sl": "Descripción del pase normal",
      "price": 100,
      "currency": "USD",
      "stock": 500
    },
    {
      "primary_text_pl": "Children Pass",
      "primary_text_sl": "Pase de Niños",
      "secondary_text_pl": "Children Pass Description",
      "secondary_text_sl": "Descripción Pase Niños",
      "price": 20.5,
      "currency": "USD",
      "stock": 600
    }
  ],
  "badge": {
      "badge_size" : "A8",
      "badge_primary_text_horizontal_location" : "center",
      "badge_primary_text_horizontal_offset": 0,
      "badge_primary_text_vertical_location" : "center",
      "badge_primary_text_vertical_offset" : 0,
      "badge_primary_text_fontsize" : 70,
      "badge_primary_text_color" : "#444444",
      "badge_primary_test_text" : "FirstName LastName",
      "badge_primary_text_break_distance" : 0,
      "badge_secondary_text_horizontal_location" : "center",
      "badge_secondary_text_horizontal_offset": 0,
      "badge_secondary_text_vertical_location" : "center",
      "badge_secondary_text_vertical_offset" : 0,
      "badge_secondary_text_fontsize" : 70,
      "badge_secondary_text_color" : "#444444",
      "badge_secondary_test_text" : "My Company",
      "badge_secondary_text_break_distance" : 0
  },
  "request_hash": "003ee10837c54e7df16801537393a110"
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://www.ticketsonic.com:9507/v1/event/new");
xhr.setRequestHeader("X-Api-UserID", "test1@ticketsonic.com");
xhr.setRequestHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6");
xhr.setRequestHeader("Content-Type", "application/json");

xhr.send(data);
                                                
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'POST',
  'hostname': 'https://www.ticketsonic.com',
  'port': 9507,
  'path': '/v1/event/new',
  'headers': {
    'X-Api-UserID': 'test1@ticketsonic.com',
    'X-API-Key': 'e059d2930e8be29314e323040c0cd2f6',
    'Content-Type': 'application/json'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData = JSON.stringify({
  "primary_text_pl": "Dinosaurs Exhibition",
  "primary_text_sl": "Exposición de dinosaurios",
  "secondary_text_pl": "Dinosaurs Exhibition Description",
  "secondary_text_sl": "Descripción de la exposición de dinosaurios",
  "location": "Louvre",
  "start_datetime": "1598989999",
  "tickets": [
    {
      "primary_text_pl": "Regular Pass",
      "primary_text_sl": "Pase Normal",
      "secondary_text_pl": "Regular pass description",
      "secondary_text_sl": "Descripción del pase normal",
      "price": 100,
      "currency": "USD",
      "stock": 500
    },
    {
      "primary_text_pl": "Children Pass",
      "primary_text_sl": "Pase de Niños",
      "secondary_text_pl": "Children Pass Description",
      "secondary_text_sl": "Descripción Pase Niños",
      "price": 20.5,
      "currency": "USD",
      "stock": 600
    }
  ],
  "badge": {
      "badge_size" : "A8",
      "badge_primary_text_horizontal_location" : "center",
      "badge_primary_text_horizontal_offset": 0,
      "badge_primary_text_vertical_location" : "center",
      "badge_primary_text_vertical_offset" : 0,
      "badge_primary_text_fontsize" : 70,
      "badge_primary_text_color" : "#444444",
      "badge_primary_test_text" : "FirstName LastName",
      "badge_primary_text_break_distance" : 0,
      "badge_secondary_text_horizontal_location" : "center",
      "badge_secondary_text_horizontal_offset": 0,
      "badge_secondary_text_vertical_location" : "center",
      "badge_secondary_text_vertical_offset" : 0,
      "badge_secondary_text_fontsize" : 70,
      "badge_secondary_text_color" : "#444444",
      "badge_secondary_test_text" : "My Company",
      "badge_secondary_text_break_distance" : 0
  },
  "request_hash": "003ee10837c54e7df16801537393a110"
});

req.write(postData);

req.end();
                                                
setRequestUrl('https://www.ticketsonic.com:9507/v1/event/new');
$request->setRequestMethod('POST');
$body = new http\Message\Body;
$body->append('{
    "primary_text_pl": "Dinosaurs Exhibition",
    "primary_text_sl": "Exposición de dinosaurios",
    "secondary_text_pl": "Dinosaurs Exhibition Description",
    "secondary_text_sl": "Descripción de la exposición de dinosaurios",
    "location": "Louvre",
    "start_datetime": "1598989999",
    "tickets" : [
        {
            "primary_text_pl": "Regular Pass",
            "primary_text_sl": "Pase Normal",
            "secondary_text_pl": "Regular pass description",
            "secondary_text_sl": "Descripción del pase normal",
            "price": 100,
            "currency": "USD",
            "stock": 500
        },
        {
            "primary_text_pl": "Children Pass",
            "primary_text_sl": "Pase de Niños",
            "secondary_text_pl": "Children Pass Description",
            "secondary_text_sl": "Descripción Pase Niños",
            "price": 20.50,
            "currency": "USD",
            "stock": 600
        }
    ],
    "badge" : {
        "badge_size" : "A8",
        "badge_primary_text_horizontal_location" : "center",
        "badge_primary_text_horizontal_offset": 0,
        "badge_primary_text_vertical_location" : "center",
        "badge_primary_text_vertical_offset" : 0,
        "badge_primary_text_fontsize" : 70,
        "badge_primary_text_color" : "#444444",
        "badge_primary_test_text" : "FirstName LastName",
        "badge_primary_text_break_distance" : 0,
        "badge_secondary_text_horizontal_location" : "center",
        "badge_secondary_text_horizontal_offset": 0,
        "badge_secondary_text_vertical_location" : "center",
        "badge_secondary_text_vertical_offset" : 0,
        "badge_secondary_text_fontsize" : 70,
        "badge_secondary_text_color" : "#444444",
        "badge_secondary_test_text" : "My Company",
        "badge_secondary_text_break_distance" : 0
    },
    "request_hash" : "003ee10837c54e7df16801537393a110"
}');
$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
  'X-Api-UserID' => 'test1@ticketsonic.com',
  'X-API-Key' => 'e059d2930e8be29314e323040c0cd2f6',
  'Content-Type' => 'application/json'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();



                                                
var client = new RestClient("https://www.ticketsonic.com:9507/v1/event/new");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("X-Api-UserID", "test1@ticketsonic.com");
request.AddHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6");
request.AddHeader("Content-Type", "application/json");
var body = @"{" + "\n" +
@"	""primary_text_pl"": ""Dinosaurs Exhibition""," + "\n" +
@"    ""primary_text_sl"": ""Exposición de dinosaurios""," + "\n" +
@"	""secondary_text_pl"": ""Dinosaurs Exhibition Description""," + "\n" +
@"    ""secondary_text_sl"": ""Descripción de la exposición de dinosaurios""," + "\n" +
@"	""location"": ""Louvre""," + "\n" +
@"	""start_datetime"": ""1598989999""," + "\n" +
@"	""tickets"" : [" + "\n" +
@"		{" + "\n" +
@"            ""primary_text_pl"": ""Regular Pass""," + "\n" +
@"            ""primary_text_sl"": ""Pase Normal""," + "\n" +
@"            ""secondary_text_pl"": ""Regular pass description""," + "\n" +
@"            ""secondary_text_sl"": ""Descripción del pase normal""," + "\n" +
@"            ""price"": 100," + "\n" +
@"            ""currency"": ""USD""," + "\n" +
@"            ""stock"": 500" + "\n" +
@"        }," + "\n" +
@"        {" + "\n" +
@"            ""primary_text_pl"": ""Children Pass""," + "\n" +
@"            ""primary_text_sl"": ""Pase de Niños""," + "\n" +
@"            ""secondary_text_pl"": ""Children Pass Description""," + "\n" +
@"            ""secondary_text_sl"": ""Descripción Pase Niños""," + "\n" +
@"            ""price"": 20.50," + "\n" +
@"            ""currency"": ""USD""," + "\n" +
@"            ""stock"": 600" + "\n" +
@"        }" + "\n" +
@"	]," + "\n" +
@"    ""badge"" : {" + "\n" +
@"        ""badge_size"" : ""A8""," + "\n" +
@"        ""badge_primary_text_horizontal_location"" : ""center""," + "\n" +
@"        ""badge_primary_text_horizontal_offset"": 0," + "\n" +
@"        ""badge_primary_text_vertical_location"" : ""center""," + "\n" +
@"        ""badge_primary_text_vertical_offset"" : 0," + "\n" +
@"        ""badge_primary_text_fontsize"" : 70," + "\n" +
@"        ""badge_primary_text_color"" : ""#444444""," + "\n" +
@"        ""badge_primary_test_text"" : ""FirstName LastName""," + "\n" +
@"        ""badge_primary_text_break_distance"" : 0," + "\n" +
@"        ""badge_secondary_text_horizontal_location"" : ""center""," + "\n" +
@"        ""badge_secondary_text_horizontal_offset"": 0," + "\n" +
@"        ""badge_secondary_text_vertical_location"" : ""center""," + "\n" +
@"        ""badge_secondary_text_vertical_offset"" : 0," + "\n" +
@"        ""badge_secondary_text_fontsize"" : 70," + "\n" +
@"        ""badge_secondary_text_color"" : ""#444444""," + "\n" +
@"        ""badge_secondary_test_text"" : ""My Company""," + "\n" +
@"        ""badge_secondary_text_break_distance"" : 0" + "\n" +
@"    }," + "\n" +
@"	""request_hash"" : ""003ee10837c54e7df16801537393a110""" + "\n" +
@"}";
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
                                                
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"primary_text_pl\": \"Dinosaurs Exhibition\",\n    \"primary_text_sl\": \"Exposición de dinosaurios\",\n\t\"secondary_text_pl\": \"Dinosaurs Exhibition Description\",\n    \"secondary_text_sl\": \"Descripción de la exposición de dinosaurios\",\n\t\"location\": \"Louvre\",\n\t\"start_datetime\": \"1598989999\",\n\t\"tickets\" : [\n\t\t{\n            \"primary_text_pl\": \"Regular Pass\",\n            \"primary_text_sl\": \"Pase Normal\",\n            \"secondary_text_pl\": \"Regular pass description\",\n            \"secondary_text_sl\": \"Descripción del pase normal\",\n            \"price\": 100,\n            \"currency\": \"USD\",\n            \"stock\": 500\n        },\n        {\n            \"primary_text_pl\": \"Children Pass\",\n            \"primary_text_sl\": \"Pase de Niños\",\n            \"secondary_text_pl\": \"Children Pass Description\",\n            \"secondary_text_sl\": \"Descripción Pase Niños\",\n            \"price\": 20.50,\n            \"currency\": \"USD\",\n            \"stock\": 600\n        }\n\t],\n    \"badge\" : {\n        \"badge_size\" : \"A8\",\n        \"badge_primary_text_horizontal_location\" : \"center\",\n        \"badge_primary_text_horizontal_offset\": 0,\n        \"badge_primary_text_vertical_location\" : \"center\",\n        \"badge_primary_text_vertical_offset\" : 0,\n        \"badge_primary_text_fontsize\" : 70,\n        \"badge_primary_text_color\" : \"#444444\",\n        \"badge_primary_test_text\" : \"FirstName LastName\",\n        \"badge_primary_text_break_distance\" : 0,\n        \"badge_secondary_text_horizontal_location\" : \"center\",\n        \"badge_secondary_text_horizontal_offset\": 0,\n        \"badge_secondary_text_vertical_location\" : \"center\",\n        \"badge_secondary_text_vertical_offset\" : 0,\n        \"badge_secondary_text_fontsize\" : 70,\n        \"badge_secondary_text_color\" : \"#444444\",\n        \"badge_secondary_test_text\" : \"My Company\",\n        \"badge_secondary_text_break_distance\" : 0\n    },\n\t\"request_hash\" : \"003ee10837c54e7df16801f5ff37393a110\"\n}");
Request request = new Request.Builder()
  .url("https://www.ticketsonic.com:9507/v1/event/new")
  .method("POST", body)
  .addHeader("X-Api-UserID", "test1@ticketsonic.com")
  .addHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6")
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();
Response response = client.newCall(request).execute();
                                                
require "uri"
require "json"
require "net/http"

url = URI("https://www.ticketsonic.com:9507/v1/event/new")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["X-Api-UserID"] = "test1@ticketsonic.com"
request["X-API-Key"] = "e059d2930e8be29314e323040c0cd2f6"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
  "primary_text_pl": "Dinosaurs Exhibition",
  "primary_text_sl": "Exposición de dinosaurios",
  "secondary_text_pl": "Dinosaurs Exhibition Description",
  "secondary_text_sl": "Descripción de la exposición de dinosaurios",
  "location": "Louvre",
  "start_datetime": "1598989999",
  "tickets": [
    {
      "primary_text_pl": "Regular Pass",
      "primary_text_sl": "Pase Normal",
      "secondary_text_pl": "Regular pass description",
      "secondary_text_sl": "Descripción del pase normal",
      "price": 100,
      "currency": "USD",
      "stock": 500
    },
    {
      "primary_text_pl": "Children Pass",
      "primary_text_sl": "Pase de Niños",
      "secondary_text_pl": "Children Pass Description",
      "secondary_text_sl": "Descripción Pase Niños",
      "price": 20.5,
      "currency": "USD",
      "stock": 600
    }
  ],
  "badge": {
    "badge_size": "A8",
    "badge_primary_text_horizontal_location": "center",
    "badge_primary_text_horizontal_offset": 0,
    "badge_primary_text_vertical_location": "center",
    "badge_primary_text_vertical_offset": 0,
    "badge_primary_text_fontsize": 70,
    "badge_primary_text_color": "#444444",
    "badge_primary_test_text": "FirstName LastName",
    "badge_primary_text_break_distance": 0,
    "badge_secondary_text_horizontal_location": "center",
    "badge_secondary_text_horizontal_offset": 0,
    "badge_secondary_text_vertical_location": "center",
    "badge_secondary_text_vertical_offset": 0,
    "badge_secondary_text_fontsize": 70,
    "badge_secondary_text_color": "#444444",
    "badge_secondary_test_text": "My Company",
    "badge_secondary_text_break_distance": 0
  },
  "request_hash": "003ee10837c54e7df16801537393a116"
})

response = http.request(request)
puts response.read_body

                                                

Response

{
    "status": "success",
    "event_id": 4067610
}
                                        

Edit Event

Event edit request is done via the following REST API request. There are several required headers and several required and optional JSON fields that have to be set in the JSON body of the request.

Headers

X-Api-UserID string Required

The UserID.

X-API-Key string Required

The User API Key.

X-API-EventID string Required

The API EventID header contains the event ID of an event that needs to be altered.

Request Body

request_hash string Required

Random sequence of characters for extra request security.

primary_text_pl string Optional

The title of the event in its primary language if needed to be changed.

primary_text_sl string Optional

The title of the event in its secondary language if needed to be changed.

secondary_text_pl string Optional

The description of the event in its primary language if needed to be changed.

secondary_text_sl string Optional

The description of the event in its secondary language if needed to be changed.

start_datetime unix timestamp Optional

The date time of the event if needed to be changed.

location string Optional

The location of the event if needed to be changed.

Object Optional

The object carrying information about the badge.

badge_size string Optional

The physical badge size.

Allowed values: A4, A5, A6, A7, A8, A9, A19
Default: A6
badge_primary_text_horizontal_location string Optional

The horizontal location of the primary text on the badge.

Allowed values: left, center, right
Default: center
badge_primary_text_horizontal_offset integer Optional

The horizontal offset in percentages added to the badge_primary_text_horizontal_location value. For example if badge_primary_text_horizontal_location is set to "left" and badge_primary_text_horizontal_offset is set to 5 then the text will appear with 5% offset from the left border of the badge.

Allowed values: 0-100
Default: 0
badge_primary_text_vertical_location string Optional

The vertical location of the primary text on the badge.

Allowed values: top, center, bottom
Default: center
badge_primary_text_vertical_offset integer Optional

The vertical offset in percentages added to the badge_primary_text_vertical_location value. For example if badge_primary_text_vertical_location is set to "center" and badge_primary_text_vertical_offset is set to 5 then the text will appear 5% higher from the vertical center of the badge.

Allowed values: 0-100
Default: -4
badge_primary_text_fontsize integer Optional

The font size of the primary text on the badge.

Allowed values: badge_primary_text_fontsize > 0
Default: 30
badge_primary_text_color string Optional

The html color of the primary text on the badge.

Allowed values: HTML colors in the form of #000000
Default: #000000
badge_primary_test_text string Optional

The primary test text to serve as an example customer name on the badge.

Allowed values: strings
Default: FirstName LastName
badge_primary_text_break_distance integer Optional

Values greater than 0 break the text so that every word appears on a new line. The value controls the distance between the lines.

Allowed values: badge_primary_text_break_distance > 0
Default: 0
badge_secondary_text_horizontal_location string Optional

The horizontal location of the secondary text on the badge.

Allowed values: left, center, right
Default: center
badge_secondary_text_horizontal_offset integer Optional

The horizontal offset in percentages added to the badge_secondary_text_horizontal_location value. For example if badge_secondary_text_horizontal_location is set to "left" and badge_secondary_text_horizontal_offset is set to 5 then the text will appear with 5% offset from the left border of the badge.

Allowed values: 0-100
Default: 0
badge_secondary_text_vertical_location string Optional

The vertical location of the secondary text on the badge.

Allowed values: top, center, bottom
Default: center
badge_secondary_text_vertical_offset integer Optional

The vertical offset in percentages added to the badge_secondary_text_vertical_location value. For example if badge_secondary_text_vertical_location is set to "center" and badge_secondary_text_vertical_offset is set to 5 then the text will appear 5% higher from the vertical center of the badge.

Allowed values: 0-100
Default: -4
badge_secondary_text_fontsize integer Optional

The font size of the secondary text on the badge.

Allowed values: badge_secondary_text_fontsize > 0
Default: 30
badge_secondary_text_color string Optional

The html color of the secondary text on the badge.

Allowed values: HTML colors in the form of #000000
Default: #000000
badge_secondary_test_text string Optional

The secondary test text to serve as an example customer name on the badge.

Allowed values: strings
Default: FirstName LastName
badge_secondary_text_break_distance integer Optional

Values greater than 0 break the text so that every word appears on a new line. The value controls the distance between the lines.

Allowed values: badge_secondary_text_break_distance > 0
Default: 0

Responses

200 Success

The request have been successfully sent.

400 unknown user Bad Request

Wrong X-Api-UserID value in the headers was provided.

400 unknown key Bad Request

Wrong X-API-Key value in the headers was provided.

400 event ownership verification failure Bad Request

Wrong X-API-EventID value in the headers was provided.

Code

POST /v1/event/edit HTTP/1.1
Host: https://www.ticketsonic.com:9507
X-Api-UserID: test1@ticketsonic.com
X-API-Key: e059d2930e8be29314e323040c0cd2f6
X-API-EventID: 4067610
Content-Type: application/json
Content-Length: 665

{
    "primary_text_pl": "Dinosaurs Exhibition",
    "primary_text_sl": "Exposición de dinosaurios",
    "secondary_text_pl": "Dinosaurs Exhibition Description",
    "secondary_text_sl": "Descripción de la exposición de dinosaurios",
    "location": "Louvre, Hall 2",
    "start_datetime": "1598989999",
    "badge" : { 
        "badge_size": "A8",
        "badge_primary_text_horizontal_location": "center",
        "badge_primary_text_horizontal_offset": 0,
        "badge_primary_text_vertical_location": "center",
        "badge_primary_text_vertical_offset": 0,
        "badge_primary_text_fontsize": 70,
        "badge_primary_text_color": "#444444",
        "badge_primary_test_text": "FirstName LastName",
        "badge_primary_text_break_distance": 0,
        "badge_secondary_text_horizontal_location": "center",
        "badge_secondary_text_horizontal_offset": 0,
        "badge_secondary_text_vertical_location": "center",
        "badge_secondary_text_vertical_offset": 0,
        "badge_secondary_text_fontsize": 70,
        "badge_secondary_text_color": "#444444",
        "badge_secondary_test_text": "My Company",
        "badge_secondary_text_break_distance": 0
    },
    "request_hash" : "003ee10837c54e7df16801537393a110"
}
                                                    
var data = JSON.stringify({
  "primary_text_pl": "Dinosaurs Exhibition",
  "primary_text_sl": "Exposición de dinosaurios",
  "secondary_text_pl": "Dinosaurs Exhibition Description",
  "secondary_text_sl": "Descripción de la exposición de dinosaurios",
  "location": "Louvre, Hall 2",
  "start_datetime": "1598989999",
  "badge": {
    "badge_size": "A8",
    "badge_primary_text_horizontal_location": "center",
    "badge_primary_text_horizontal_offset": 0,
    "badge_primary_text_vertical_location": "center",
    "badge_primary_text_vertical_offset": 0,
    "badge_primary_text_fontsize": 70,
    "badge_primary_text_color": "#444444",
    "badge_primary_test_text": "FirstName LastName",
    "badge_primary_text_break_distance": 0,
    "badge_secondary_text_horizontal_location": "center",
    "badge_secondary_text_horizontal_offset": 0,
    "badge_secondary_text_vertical_location": "center",
    "badge_secondary_text_vertical_offset": 0,
    "badge_secondary_text_fontsize": 70,
    "badge_secondary_text_color": "#444444",
    "badge_secondary_test_text": "My Company",
    "badge_secondary_text_break_distance": 0
  },
  "request_hash": "003ee10837c54e7df16801537393a110"
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://www.ticketsonic.com:9507/v1/event/edit");
xhr.setRequestHeader("X-Api-UserID", "test1@ticketsonic.com");
xhr.setRequestHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6");
xhr.setRequestHeader("X-API-EventID", "4067610");
xhr.setRequestHeader("Content-Type", "application/json");

xhr.send(data);
                                                    
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'POST',
  'hostname': 'https://www.ticketsonic.com',
  'port': 9507,
  'path': '/v1/event/edit',
  'headers': {
    'X-Api-UserID': 'test1@ticketsonic.com',
    'X-API-Key': 'e059d2930e8be29314e323040c0cd2f6',
    'X-API-EventID': '4067610',
    'Content-Type': 'application/json'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData = JSON.stringify({
  "primary_text_pl": "Dinosaurs Exhibition",
  "primary_text_sl": "Exposición de dinosaurios",
  "secondary_text_pl": "Dinosaurs Exhibition Description",
  "secondary_text_sl": "Descripción de la exposición de dinosaurios",
  "location": "Louvre, Hall 2",
  "start_datetime": "1598989999",
  "badge": {
    "badge_size": "A8",
    "badge_primary_text_horizontal_location": "center",
    "badge_primary_text_horizontal_offset": 0,
    "badge_primary_text_vertical_location": "center",
    "badge_primary_text_vertical_offset": 0,
    "badge_primary_text_fontsize": 70,
    "badge_primary_text_color": "#444444",
    "badge_primary_test_text": "FirstName LastName",
    "badge_primary_text_break_distance": 0,
    "badge_secondary_text_horizontal_location": "center",
    "badge_secondary_text_horizontal_offset": 0,
    "badge_secondary_text_vertical_location": "center",
    "badge_secondary_text_vertical_offset": 0,
    "badge_secondary_text_fontsize": 70,
    "badge_secondary_text_color": "#444444",
    "badge_secondary_test_text": "My Company",
    "badge_secondary_text_break_distance": 0
  },
  "request_hash": "003ee10837c54e7df16801537393a110"
});

req.write(postData);

req.end();
                                                    
setRequestUrl('https://www.ticketsonic.com:9507/v1/event/edit');
$request->setRequestMethod('POST');
$body = new http\Message\Body;
$body->append('{
    "primary_text_pl": "Dinosaurs Exhibition",
    "primary_text_sl": "Exposición de dinosaurios",
    "secondary_text_pl": "Dinosaurs Exhibition Description",
    "secondary_text_sl": "Descripción de la exposición de dinosaurios",
    "location": "Louvre, Hall 2",
    "start_datetime": "1598989999",
    "badge" : { 
        "badge_size": "A8",
        "badge_primary_text_horizontal_location": "center",
        "badge_primary_text_horizontal_offset": 0,
        "badge_primary_text_vertical_location": "center",
        "badge_primary_text_vertical_offset": 0,
         "badge_primary_text_fontsize": 70,
        "badge_primary_text_color": "#444444",
        "badge_primary_test_text": "FirstName LastName",
        "badge_primary_text_break_distance": 0,
        "badge_secondary_text_horizontal_location": "center",
        "badge_secondary_text_horizontal_offset": 0,
        "badge_secondary_text_vertical_location": "center",
        "badge_secondary_text_vertical_offset": 0,
        "badge_secondary_text_fontsize": 70,
        "badge_secondary_text_color": "#444444",
        "badge_secondary_test_text": "My Company",
        "badge_secondary_text_break_distance": 0
    },
    "request_hash" : "003ee10837c54e7df16801537393a110"
}');
$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
  'X-Api-UserID' => 'test1@ticketsonic.com',
  'X-API-Key' => 'e059d2930e8be29314e323040c0cd2f6',
  'X-API-EventID' => '4067610',
  'Content-Type' => 'application/json'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();

    
    
                                                    
var client = new RestClient("https://www.ticketsonic.com:9507/v1/event/edit");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("X-Api-UserID", "test1@ticketsonic.com");
request.AddHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6");
request.AddHeader("X-API-EventID", "4067610");
request.AddHeader("Content-Type", "application/json");
var body = @"{" + "\n" +
@"    ""primary_text_pl"": ""Dinosaurs Exhibition""," + "\n" +
@"    ""primary_text_sl"": ""Exposición de dinosaurios""," + "\n" +
@"	""secondary_text_pl"": ""Dinosaurs Exhibition Description""," + "\n" +
@"    ""secondary_text_sl"": ""Descripción de la exposición de dinosaurios""," + "\n" +
@"    ""location"": ""Louvre, Hall 2""," + "\n" +
@"    ""start_datetime"": ""1598989999""," + "\n" +
@"    ""badge"" : {" + "\n" +
@"        ""badge_size"" : ""A7""," + "\n" +
@"        ""badge_primary_text_horizontal_location"" : ""left""," + "\n" +
@"        ""badge_primary_text_horizontal_offset"": 1," + "\n" +
@"        ""badge_primary_text_vertical_location"" : ""top""," + "\n" +
@"        ""badge_primary_text_vertical_offset"" : 2," + "\n" +
@"        ""badge_primary_text_fontsize"" : 80," + "\n" +
@"        ""badge_primary_text_color"" : ""#222222""," + "\n" +
@"        ""badge_primary_test_text"" : ""Primary Test Text1""," + "\n" +
@"        ""badge_primary_text_break_distance"" : 10," + "\n" +
@"        ""badge_secondary_text_horizontal_location"" : ""right""," + "\n" +
@"        ""badge_secondary_text_horizontal_offset"": 3," + "\n" +
@"        ""badge_secondary_text_vertical_location"" : ""bottom""," + "\n" +
@"        ""badge_secondary_text_vertical_offset"" : 4," + "\n" +
@"        ""badge_secondary_text_fontsize"" : 60," + "\n" +
@"        ""badge_secondary_text_color"" : ""#333333""," + "\n" +
@"        ""badge_secondary_test_text"" : ""Secondary Test Text1""," + "\n" +
@"        ""badge_secondary_text_break_distance"" : 5" + "\n" +
@"    }," + "\n" +
@"    ""request_hash"" : ""003ees10837c54eddf16801537393a110""" + "\n" +
@"}";
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
                                                    
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"primary_text_pl\": \"Dinosaurs Exhibition\",\n    \"primary_text_sl\": \"Exposición de dinosaurios\",\n\t\"secondary_text_pl\": \"Dinosaurs Exhibition Description\",\n    \"secondary_text_sl\": \"Descripción de la exposición de dinosaurios\",\n    \"location\": \"Louvre, Hall 2\",\n    \"start_datetime\": \"1598989999\",\n    \"badge\" : {\n        \"badge_size\" : \"A7\",\n        \"badge_primary_text_horizontal_location\" : \"left\",\n        \"badge_primary_text_horizontal_offset\": 1,\n        \"badge_primary_text_vertical_location\" : \"top\",\n        \"badge_primary_text_vertical_offset\" : 2,\n        \"badge_primary_text_fontsize\" : 80,\n        \"badge_primary_text_color\" : \"#222222\",\n        \"badge_primary_test_text\" : \"Primary Test Text1\",\n        \"badge_primary_text_break_distance\" : 10,\n        \"badge_secondary_text_horizontal_location\" : \"right\",\n        \"badge_secondary_text_horizontal_offset\": 3,\n        \"badge_secondary_text_vertical_location\" : \"bottom\",\n        \"badge_secondary_text_vertical_offset\" : 4,\n        \"badge_secondary_text_fontsize\" : 60,\n        \"badge_secondary_text_color\" : \"#333333\",\n        \"badge_secondary_test_text\" : \"Secondary Test Text1\",\n        \"badge_secondary_text_break_distance\" : 5\n    },\n    \"request_hash\" : \"003ees10837c54eddf16801537393a110\"\n}");
Request request = new Request.Builder()
  .url("https://www.ticketsonic.com:9507/v1/event/edit")
  .method("POST", body)
  .addHeader("X-Api-UserID", "test1@ticketsonic.com")
  .addHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6")
  .addHeader("X-API-EventID", "4067610")
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();
                                                    
require "uri"
require "json"
require "net/http"

url = URI("https://www.ticketsonic.com:9507/v1/event/edit")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["X-Api-UserID"] = "test1@ticketsonic.com"
request["X-API-Key"] = "e059d2930e8be29314e323040c0cd2f6"
request["X-API-EventID"] = "4067610"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
  "primary_text_pl": "Dinosaurs Exhibition",
  "primary_text_sl": "Exposición de dinosaurios",
  "secondary_text_pl": "Dinosaurs Exhibition Description",
  "secondary_text_sl": "Descripción de la exposición de dinosaurios",
  "location": "Louvre, Hall 2",
  "start_datetime": "1598989999",
  "badge": {
    "badge_size": "A7",
    "badge_primary_text_horizontal_location": "left",
    "badge_primary_text_horizontal_offset": 1,
    "badge_primary_text_vertical_location": "top",
    "badge_primary_text_vertical_offset": 2,
    "badge_primary_text_fontsize": 80,
    "badge_primary_text_color": "#222222",
    "badge_primary_test_text": "Primary Test Text1",
    "badge_primary_text_break_distance": 10,
    "badge_secondary_text_horizontal_location": "right",
    "badge_secondary_text_horizontal_offset": 3,
    "badge_secondary_text_vertical_location": "bottom",
    "badge_secondary_text_vertical_offset": 4,
    "badge_secondary_text_fontsize": 60,
    "badge_secondary_text_color": "#333333",
    "badge_secondary_test_text": "Secondary Test Text1",
    "badge_secondary_text_break_distance": 5
  },
  "request_hash": "003ees10837c54eddf16801537393a110"
})

response = http.request(request)
puts response.read_body

                                                    

Response

{
    "status": "success"
}
                                            


Orders API

The following Orders API is responsible for requesting a tickets purchase. You can request new orders.

Create Order

Order creation is done via the following REST API request. There are several required headers and several required and optional JSON fields that have to be set in the JSON body of the request.

Headers

X-Api-UserID string Required

The UserID.

X-API-Key string Required

The User API Key.

Request Body

request_hash string Required

Random sequence of characters for extra request security.

Object Optional

The object carrying information about the customer ordered the tickets.

primary_text_pl string Optional

The name of the customer. Used for auto printing the badge.

secondary_text_pl string Optional

The company (affiliation) of the customer. Used for auto printing the badge.

Object Required

The object carrying information about the ordered tickets.

sku string Required

The unique identifier of the ticket that have to be placed in the order.

stock integer Required

How many tickets have to be placed in the order.

Allowed values:stock > 0
start_time unix timestamp Optional

The date time the ticket should be valid from.

end_time unix timestamp Optional

The date time the ticket should be valid to.

Responses

200 Success

The request have been successfully sent.

400 unknown user Bad Request

Wrong X-Api-UserID value in the headers was provided.

400 unknown key Bad Request

Wrong X-API-Key value in the headers was provided.

400 invalid stock or sku Bad Request

Invalid sku used or insufficient stock was requested.

400 duplicated order Bad Request

Non unique hash was provided.

Code

POST /v1/order/new HTTP/1.1
Host: https://www.ticketsonic.com:9507
X-Api-UserID: test1@ticketsonic.com
X-API-Key: e059d2930e8be29314e323040c0cd2f6
Content-Type: application/json
Content-Length: 659

{
    "request_hash" : "003ee10837c54e7df16801537393f116",
    "order_details": {
        "primary_text_pl" : "Martin Vassilev",
        "secondary_text_pl" : "Martin Vassilev's Company"
    },
    "tickets" : [
    {
        "sku": "318-46222",
         "stock": 1,
        "start_time" : "1615233535",
        "end_time" : "1615273479"
    },
    {
        "sku": "318-46218",
        "stock": 1,
        "start_time" : "1615233535",
        "end_time" : "1615273479"
    },
    {
        "sku": "318-46217",
        "stock": 1,
        "start_time" : "1615233535",
        "end_time" : "1615273479"
    }
    ]
}
                                                
var data = JSON.stringify({
  "request_hash": "003ee10837c54e7df16801537393f116",
  "order_details": {
    "primary_text_pl": "Martin Vassilev",
    "secondary_text_pl": "Martin Vassilev's Company"
  },
  "tickets": [
    {
      "sku": "318-46222",
      "stock": 1,
      "start_time": "1615233535",
      "end_time": "1615273479"
    },
    {
      "sku": "318-46218",
      "stock": 1,
      "start_time": "1615233535",
      "end_time": "1615273479"
    },
    {
      "sku": "318-46217",
      "stock": 1,
      "start_time": "1615233535",
      "end_time": "1615273479"
    }
  ]
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://www.ticketsonic.com:9507/v1/order/new");
xhr.setRequestHeader("X-Api-UserID", "test1@ticketsonic.com");
xhr.setRequestHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6");
xhr.setRequestHeader("Content-Type", "application/json");

xhr.send(data);
                                                
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'POST',
  'hostname': 'https://www.ticketsonic.com',
  'port': 9507,
  'path': '/v1/order/new',
  'headers': {
    'X-Api-UserID': 'test1@ticketsonic.com',
    'X-API-Key': 'e059d2930e8be29314e323040c0cd2f6',
    'Content-Type': 'application/json'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData = JSON.stringify({
  "request_hash": "003ee10837c54e7df16801537393f116",
  "order_details": {
    "primary_text_pl": "Martin Vassilev",
    "secondary_text_pl": "Martin Vassilev's Company"
  },
  "tickets": [
    {
      "sku": "318-46222",
      "stock": 1,
      "start_time": "1615233535",
      "end_time": "1615273479"
    },
    {
      "sku": "318-46218",
      "stock": 1,
      "start_time": "1615233535",
      "end_time": "1615273479"
    },
    {
      "sku": "318-46217",
      "stock": 1,
      "start_time": "1615233535",
      "end_time": "1615273479"
    }
  ]
});

req.write(postData);

req.end();
                                                
setRequestUrl('https://www.ticketsonic.com:9507/v1/order/new');
$request->setRequestMethod('POST');
$body = new http\Message\Body;
$body->append('{
	"request_hash" : "003ee10837c54e7df16801537393f116",
	"order_details": {
		"primary_text_pl" : "Martin Vassilev",
        "secondary_text_pl" : "Martin Vassilev's Company"
	},
	"tickets" : [
		{
            "sku": "318-46222",
            "stock": 1,
            "start_time" : "1615233535",
            "end_time" : "1615273479"
        },
        {
            "sku": "318-46218",
            "stock": 1,
            "start_time" : "1615233535",
            "end_time" : "1615273479"
        },
        {
            "sku": "318-46217",
            "stock": 1,
            "start_time" : "1615233535",
            "end_time" : "1615273479"
        }
	]
}');
$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
  'X-Api-UserID' => 'test1@ticketsonic.com',
  'X-API-Key' => 'e059d2930e8be29314e323040c0cd2f6',
  'Content-Type' => 'application/json'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
                                                
var client = new RestClient("https://www.ticketsonic.com:9507/v1/order/new");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("X-Api-UserID", "test1@ticketsonic.com");
request.AddHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6");
request.AddHeader("Content-Type", "application/json");
var body = @"{" + "\n" +
@"	""request_hash"" : ""003ee10837c54e7df16801537393f116""," + "\n" +
@"	""order_details"": {" + "\n" +
@"		""primary_text_pl"" : ""Martin Vassilev""," + "\n" +
@"        ""secondary_text_pl"" : ""Martin Vassilev's Company""" + "\n" +
@"	}," + "\n" +
@"	""tickets"" : [" + "\n" +
@"		{" + "\n" +
@"            ""sku"": ""318-46222""," + "\n" +
@"            ""stock"": 1," + "\n" +
@"            ""start_time"" : ""1615233535""," + "\n" +
@"            ""end_time"" : ""1615273479""" + "\n" +
@"        }," + "\n" +
@"        {" + "\n" +
@"            ""sku"": ""318-46218""," + "\n" +
@"            ""stock"": 1," + "\n" +
@"            ""start_time"" : ""1615233535""," + "\n" +
@"            ""end_time"" : ""1615273479""" + "\n" +
@"        }," + "\n" +
@"        {" + "\n" +
@"            ""sku"": ""318-46217""," + "\n" +
@"            ""stock"": 1," + "\n" +
@"            ""start_time"" : ""1615233535""," + "\n" +
@"            ""end_time"" : ""1615273479""" + "\n" +
@"        }" + "\n" +
@"	]" + "\n" +
@"}";
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
                                                
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"request_hash\" : \"003ee10837c54e7df16801537393f116\",\n\t\"order_details\": {\n\t\t\"primary_text_pl\" : \"Martin Vassilev\",\n        \"secondary_text_pl\" : \"Martin Vassilev's Company\"\n\t},\n\t\"tickets\" : [\n\t\t{\n            \"sku\": \"318-46222\",\n            \"stock\": 1,\n            \"start_time\" : \"1615233535\",\n            \"end_time\" : \"1615273479\"\n        },\n        {\n            \"sku\": \"318-46218\",\n            \"stock\": 1,\n            \"start_time\" : \"1615233535\",\n            \"end_time\" : \"1615273479\"\n        },\n        {\n            \"sku\": \"318-46217\",\n            \"stock\": 1,\n            \"start_time\" : \"1615233535\",\n            \"end_time\" : \"1615273479\"\n        }\n\t]\n}");
Request request = new Request.Builder()
  .url("https://www.ticketsonic.com:9507/v1/order/new")
  .method("POST", body)
  .addHeader("X-Api-UserID", "test1@ticketsonic.com")
  .addHeader("X-API-Key", "e059d2930e8be29314e323040c0cd2f6")
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();
                                                
require "uri"
require "json"
require "net/http"

url = URI("https://www.ticketsonic.com:9507/v1/order/new")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["X-Api-UserID"] = "test1@ticketsonic.com"
request["X-API-Key"] = "e059d2930e8be29314e323040c0cd2f6"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
  "request_hash": "003ee10837c54e7df16801537393f116",
  "order_details": {
    "primary_text_pl": "Martin Vassilev",
    "secondary_text_pl": "Martin Vassilev's Company"
  },
  "tickets": [
    {
      "sku": "318-46222",
      "stock": 1,
      "start_time": "1615233535",
      "end_time": "1615273479"
    },
    {
      "sku": "318-46218",
      "stock": 1,
      "start_time": "1615233535",
      "end_time": "1615273479"
    },
    {
      "sku": "318-46217",
      "stock": 1,
      "start_time": "1615233535",
      "end_time": "1615273479"
    }
  ]
})

response = http.request(request)
puts response.read_body

                                                

Response

{
    "status": "success",
    "tickets": [
        {
            "encrypted_data": "eNHLS+upw1T4gZ317Nb17ACvuEAR6TmvHUBBoaNsSdUGNlgHCwIGhrtfzY75Uptj6ozyHX3F9NCo+3tv2zvmqg==",
            "code": "rsa",
            "sku": "318-46222",
            "primary_text_pl": "Martin Vassilev",
            "secondary_text_pl": "Martin Vassilev's Company"
        },
        {
            "encrypted_data": "GfbA74/IBA5kI0EiX7o7CmPLM1yo9ny78bsKnXGfHuVWZCaHDscL+dwUUVXBx/V5mNhkd42cnIGFjExyIGBGPg==",
            "code": "rsa",
            "sku": "318-46218",
            "primary_text_pl": "Martin Vassilev",
            "secondary_text_pl": "Martin Vassilev's Company"
        },
        {
            "encrypted_data": "T1NXc+S3K7FLHhUq1CeEw+/aK7qWjfLJLJIHwBYXrEhJbKgeENbgvF/4VdpOBa6Np1DqfZxhImlsbypSf1kXGQ==",
            "code": "rsa",
            "sku": "318-46217",
            "primary_text_pl": "Martin Vassilev",
            "secondary_text_pl": "Martin Vassilev's Company"
        }
    ],
    "request_hash": "003ee10837c54e7df16801537393f116"
}