Prestia API

Authentication

tokenPost

Login and get access token.

Get access token for next authenticated calls.


/token

Usage and SDK Samples

curl -X POST\
 -H "Authorization: Bearer [[accessToken]]"\
-H "Accept: application/json"\
-H "Content-Type: application/json"\
"https://sandbox.api.prestia.smartticket.it/api/token"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.AuthenticationApi;

import java.io.File;
import java.util.*;

public class AuthenticationApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();


        AuthenticationApi apiInstance = new AuthenticationApi();
        AuthRequest body = ; // AuthRequest | 
        try {
            AuthResponse result = apiInstance.tokenPost(body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AuthenticationApi#tokenPost");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.AuthenticationApi;

public class AuthenticationApiExample {

    public static void main(String[] args) {
        AuthenticationApi apiInstance = new AuthenticationApi();
        AuthRequest body = ; // AuthRequest | 
        try {
            AuthResponse result = apiInstance.tokenPost(body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AuthenticationApi#tokenPost");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
AuthRequest *body = ; // 

AuthenticationApi *apiInstance = [[AuthenticationApi alloc] init];

// Login and get access token.
[apiInstance tokenPostWith:body
              completionHandler: ^(AuthResponse output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var PrestiaApi = require('prestia_api');
var defaultClient = PrestiaApi.ApiClient.instance;


var api = new PrestiaApi.AuthenticationApi()
var body = ; // {{AuthRequest}} 

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.tokenPost(body, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class tokenPostExample
    {
        public void main()
        {


            var apiInstance = new AuthenticationApi();
            var body = new AuthRequest(); // AuthRequest | 

            try
            {
                // Login and get access token.
                AuthResponse result = apiInstance.tokenPost(body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AuthenticationApi.tokenPost: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');


$api_instance = new Swagger\Client\ApiAuthenticationApi();
$body = ; // AuthRequest | 

try {
    $result = $api_instance->tokenPost($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AuthenticationApi->tokenPost: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::AuthenticationApi;


my $api_instance = WWW::SwaggerClient::AuthenticationApi->new();
my $body = WWW::SwaggerClient::Object::AuthRequest->new(); # AuthRequest | 

eval { 
    my $result = $api_instance->tokenPost(body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AuthenticationApi->tokenPost: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint


# create an instance of the API class
api_instance = swagger_client.AuthenticationApi()
body =  # AuthRequest | 

try: 
    # Login and get access token.
    api_response = api_instance.token_post(body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling AuthenticationApi->tokenPost: %s\n" % e)

Parameters

Body parameters
Name Description
body *

Responses

Status: 200 - OK

Status: 500 - Internal Server Error. Contact Us for assistance


Services

v1CruisesGet

Get all cruises

Get all cruises that are available for purchase


/v1/cruises

Usage and SDK Samples

curl -X GET\
 -H "Authorization: Bearer [[accessToken]]"\
-H "Accept: application/json"\
"https://sandbox.api.prestia.smartticket.it/api/v1/cruises"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.ServicesApi;

import java.io.File;
import java.util.*;

public class ServicesApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();


        ServicesApi apiInstance = new ServicesApi();
        try {
            CruiseIndex result = apiInstance.v1CruisesGet();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ServicesApi#v1CruisesGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.ServicesApi;

public class ServicesApiExample {

    public static void main(String[] args) {
        ServicesApi apiInstance = new ServicesApi();
        try {
            CruiseIndex result = apiInstance.v1CruisesGet();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ServicesApi#v1CruisesGet");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

ServicesApi *apiInstance = [[ServicesApi alloc] init];

// Get all cruises
[apiInstance v1CruisesGetWithCompletionHandler: 
              ^(CruiseIndex output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var PrestiaApi = require('prestia_api');
var defaultClient = PrestiaApi.ApiClient.instance;


var api = new PrestiaApi.ServicesApi()
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.v1CruisesGet(callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class v1CruisesGetExample
    {
        public void main()
        {


            var apiInstance = new ServicesApi();

            try
            {
                // Get all cruises
                CruiseIndex result = apiInstance.v1CruisesGet();
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling ServicesApi.v1CruisesGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');


$api_instance = new Swagger\Client\ApiServicesApi();

try {
    $result = $api_instance->v1CruisesGet();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ServicesApi->v1CruisesGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::ServicesApi;


my $api_instance = WWW::SwaggerClient::ServicesApi->new();

eval { 
    my $result = $api_instance->v1CruisesGet();
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling ServicesApi->v1CruisesGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint


# create an instance of the API class
api_instance = swagger_client.ServicesApi()

try: 
    # Get all cruises
    api_response = api_instance.v1_cruises_get()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ServicesApi->v1CruisesGet: %s\n" % e)

Parameters

Responses

Status: 200 - OK

Status: 401 - Access token is missing or invalid

Status: 500 - Internal Server Error. Contact Us for assistance


v1PurchasesPost

Save a purchase

This endpoint checks for tickets availability and generates them


/v1/purchases

Usage and SDK Samples

curl -X POST\
 -H "Authorization: Bearer [[accessToken]]"\
-H "Accept: application/json"\
-H "Content-Type: application/json"\
"https://sandbox.api.prestia.smartticket.it/api/v1/purchases"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.ServicesApi;

import java.io.File;
import java.util.*;

public class ServicesApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();


        ServicesApi apiInstance = new ServicesApi();
        PurchaseStoreRequest body = ; // PurchaseStoreRequest | 
        try {
            PurchaseStoreResponse result = apiInstance.v1PurchasesPost(body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ServicesApi#v1PurchasesPost");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.ServicesApi;

public class ServicesApiExample {

    public static void main(String[] args) {
        ServicesApi apiInstance = new ServicesApi();
        PurchaseStoreRequest body = ; // PurchaseStoreRequest | 
        try {
            PurchaseStoreResponse result = apiInstance.v1PurchasesPost(body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ServicesApi#v1PurchasesPost");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
PurchaseStoreRequest *body = ; // 

ServicesApi *apiInstance = [[ServicesApi alloc] init];

// Save a purchase
[apiInstance v1PurchasesPostWith:body
              completionHandler: ^(PurchaseStoreResponse output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var PrestiaApi = require('prestia_api');
var defaultClient = PrestiaApi.ApiClient.instance;


var api = new PrestiaApi.ServicesApi()
var body = ; // {{PurchaseStoreRequest}} 

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.v1PurchasesPost(body, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class v1PurchasesPostExample
    {
        public void main()
        {


            var apiInstance = new ServicesApi();
            var body = new PurchaseStoreRequest(); // PurchaseStoreRequest | 

            try
            {
                // Save a purchase
                PurchaseStoreResponse result = apiInstance.v1PurchasesPost(body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling ServicesApi.v1PurchasesPost: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');


$api_instance = new Swagger\Client\ApiServicesApi();
$body = ; // PurchaseStoreRequest | 

try {
    $result = $api_instance->v1PurchasesPost($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ServicesApi->v1PurchasesPost: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::ServicesApi;


my $api_instance = WWW::SwaggerClient::ServicesApi->new();
my $body = WWW::SwaggerClient::Object::PurchaseStoreRequest->new(); # PurchaseStoreRequest | 

eval { 
    my $result = $api_instance->v1PurchasesPost(body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling ServicesApi->v1PurchasesPost: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint


# create an instance of the API class
api_instance = swagger_client.ServicesApi()
body =  # PurchaseStoreRequest | 

try: 
    # Save a purchase
    api_response = api_instance.v1_purchases_post(body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ServicesApi->v1PurchasesPost: %s\n" % e)

Parameters

Body parameters
Name Description
body *

Responses

Status: 200 - The stored purchase information returned by the POST endpoint has two main info that needs to be managed: A Ticket Number: a code that we use to identify the purchase, so multiple tickets generated on the same purchase will have the same ticket number. This is what you need to provide to us in case of problems with a purchase made. A PNR Code: A Code that identifies a ticket. This is the code that needs to be included in the QR Code that can be printed by the user.The QR Core must be printed from the user for the ticket validation system to work.

Status: 401 - Access token is missing or invalid

Status: 422 - Unprocessable Entity (Problem with the request)

Status: 500 - Internal Server Error. Contact Us for assistance