Skip to content

Latest commit

 

History

History
204 lines (161 loc) · 6.56 KB

AnalyticsApi.md

File metadata and controls

204 lines (161 loc) · 6.56 KB

Com.Hopper.Hts.Airlines.Api.AnalyticsApi

All URIs are relative to https://airlines-api.hopper.com/airline/v1.1

Method HTTP request Description
PostCustomerEvents POST /customer/events Send a Frontend Event
PostEvents POST /events Send a Backend Event

PostCustomerEvents

void PostCustomerEvents (CfarEvent cfarEvent)

Send a Frontend Event

Events can also be sent directly from a frontend running on end customer's device using the session ID

Example

using System.Collections.Generic;
using System.Diagnostics;
using Com.Hopper.Hts.Airlines.Api;
using Com.Hopper.Hts.Airlines.Client;
using Com.Hopper.Hts.Airlines.Model;

namespace Example
{
    public class PostCustomerEventsExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://airlines-api.hopper.com/airline/v1.1";
            // Configure API key authorization: SessionAuth
            config.AddApiKey("HC-Session-ID", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("HC-Session-ID", "Bearer");

            var apiInstance = new AnalyticsApi(config);
            var cfarEvent = new CfarEvent(); // CfarEvent | 

            try
            {
                // Send a Frontend Event
                apiInstance.PostCustomerEvents(cfarEvent);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling AnalyticsApi.PostCustomerEvents: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the PostCustomerEventsWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Send a Frontend Event
    apiInstance.PostCustomerEventsWithHttpInfo(cfarEvent);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling AnalyticsApi.PostCustomerEventsWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
cfarEvent CfarEvent

Return type

void (empty response body)

Authorization

SessionAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 The event has been successfully created * Expires -
* Cache-Control -
400 Syntactic errors were encountered while handling the request -
401 The client could not be authenticated -
403 The authenticated client does not have permission to call this endpoint -
422 Semantic errors were encountered while handling the request -
500 The server encountered an internal error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PostEvents

void PostEvents (string hCSessionID, Event varEvent)

Send a Backend Event

Events can be send directly from partner backend using the same authentication as the other endpoints

Example

using System.Collections.Generic;
using System.Diagnostics;
using Com.Hopper.Hts.Airlines.Api;
using Com.Hopper.Hts.Airlines.Client;
using Com.Hopper.Hts.Airlines.Model;

namespace Example
{
    public class PostEventsExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://airlines-api.hopper.com/airline/v1.1";
            // Configure Bearer token for authorization: PartnerAuth
            config.AccessToken = "YOUR_BEARER_TOKEN";

            var apiInstance = new AnalyticsApi(config);
            var hCSessionID = 9fd3f2f9-e5aa-4128-ace9-3c4ee37b685f;  // string | The ID of the current airline session, see [Sessions](#tag/Sessions)
            var varEvent = new Event(); // Event | 

            try
            {
                // Send a Backend Event
                apiInstance.PostEvents(hCSessionID, varEvent);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling AnalyticsApi.PostEvents: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the PostEventsWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Send a Backend Event
    apiInstance.PostEventsWithHttpInfo(hCSessionID, varEvent);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling AnalyticsApi.PostEventsWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
hCSessionID string The ID of the current airline session, see Sessions
varEvent Event

Return type

void (empty response body)

Authorization

PartnerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
204 The event has been successfully created * Expires -
* Cache-Control -
400 Syntactic errors were encountered while handling the request -
401 The client could not be authenticated -
403 The authenticated client does not have permission to call this endpoint -
404 The requested resource could not be found -
422 Semantic errors were encountered while handling the request -
500 The server encountered an internal error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]