### HTTP Request Example Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 This example shows the raw HTTP GET request details for fetching search suggestions, including headers and host. ```http GET /search/suggestions?domain&query&sort_by&lang&include_packages HTTP/1.1 Host: https://app.ticketmaster.eu/mfxapi/v2 Accept: application/json Content-Length: 0 ``` -------------------------------- ### Example Request and Response Headers Source: https://developer.ticketmaster.com/products-and-docs/apis/discovery-manual/v2 This shows an example of the GET request and its corresponding HTTP response headers when searching for events. Note the 'Rate-Limit' and 'Content-Type' headers. ```http GET /discovery/v2/events.json?apikey={apikey}&size=1 HTTP/1.1 Host: app.ticketmaster.com X-Target-URI: https://app.ticketmaster.com Connection: Keep-Alive HTTP/1.1 200 OK Rate-Limit-Over: 0 Content-Length: 5360 Rate-Limit-Available: 4723 Set-Cookie: CMPS=0ytJbt229sTM7UXhHxC5IEvVNguFRwkBBUZ76aK9bmvRvAWZwe/RjM5TSH0yOXNFGd+urQFTC6o=; path=/ Access-Control-Max-Age: 3628800 Access-Control-Allow-Methods: GET, PUT, POST, DELETE Connection: keep-alive Server: Apache-Coyote/1.1 Rate-Limit-Reset: 1457417554290 Access-Control-Allow-Headers: origin, x-requested-with, accept Date: Mon, 07 Mar 2016 10:09:51 GMT Access-Control-Allow-Origin: * X-Application-Context: application:local,default,jphx1:8080 Content-Type: application/json;charset=utf-8 X-Unknown-Params: apikey X-Unknown-Params: api-key Rate-Limit: 5000 { "_links": { "self": { "href": "/discovery/v2/events.json?size=1{&page,sort}", ``` -------------------------------- ### Get Started with The Discovery API Source: https://developer.ticketmaster.com/products-and-docs/tutorials A basic walkthrough of the Discovery API designed to help users quickly extract value from its functionalities. This is a starting point for understanding and utilizing the API. ```javascript // Example code for getting started with the Discovery API would go here. // This snippet is a placeholder as the actual code was not provided in the text. ``` -------------------------------- ### Example API Request (GET) Source: https://developer.ticketmaster.com/products-and-docs/apis/discovery-api/v2 This shows the format of an HTTP GET request to the Discovery API for fetching events. It includes necessary headers and the API endpoint. ```http GET /discovery/v2/events.json?apikey={apikey}&size=1 HTTP/1.1 Host: app.ticketmaster.com X-Target-URI: https://app.ticketmaster.com Connection: Keep-Alive ``` -------------------------------- ### HTTP Request Example Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 This is an example of an HTTP GET request for event prices, showing the request line and headers. ```HTTP GET /events/449621/prices?domain_ids&lang&price_level_ids HTTP/1.1 Host: https://app.ticketmaster.eu/mfxapi/v2 Accept: application/json Content-Length: 0 ``` -------------------------------- ### VB.NET Example for Fetching Attraction Details Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 Shows how to retrieve attraction details using System.Net.WebRequest in VB.NET. This example sets the request method to GET and specifies the Accept header for JSON. ```vbnet Dim request = TryCast(System.Net.WebRequest.Create("https://app.ticketmaster.eu/mfxapi/v2/attractions/709593?lang&domain"), System.Net.HttpWebRequest) request.Method = "GET" request.Accept = "application/json" request.ContentLength = 0 Dim responseContent As String Using response = TryCast(request.GetResponse(), System.Net.HttpWebResponse) Using reader = New System.IO.StreamReader(response.GetResponseStream()) responseContent = reader.ReadToEnd() End Using End Using ``` -------------------------------- ### Example Request and Response for Event Images Source: https://developer.ticketmaster.com/products-and-docs/apis/discovery-api/v2 This example shows a sample HTTP GET request for event images and its corresponding successful 200 OK response, including the structure of the image data. ```http GET /discovery/v2/events/0B004F0401BD55E5/images.json?apikey={apikey} HTTP/1.1 Host: app.ticketmaster.com X-Target-URI: https://app.ticketmaster.com Connection: Keep-Alive ``` ```json HTTP/1.1 200 OK Rate-Limit-Over: 0 Content-Length: 1791 Rate-Limit-Available: 4721 Set-Cookie: CMPS=JZE+KB6vdvAgtu5+7+q5LjU8d3RbODYo2jv3r5+vwk0BcMxjtg3kAFdo3D2gFulS; path=/ Access-Control-Max-Age: 3628800 Access-Control-Allow-Methods: GET, PUT, POST, DELETE Connection: keep-alive Server: Apache-Coyote/1.1 Rate-Limit-Reset: 1457417554290 Access-Control-Allow-Headers: origin, x-requested-with, accept Date: Mon, 07 Mar 2016 10:15:18 GMT Access-Control-Allow-Origin: * X-Application-Context: application:local,default,jphx1:8080 Content-Type: application/json;charset=utf-8 X-Unknown-Params: apikey X-Unknown-Params: api-key Rate-Limit: 5000 { "type": "event", "id": "k7vGFKzleBdwS", "images": [ { "ratio": "16_9", "url": "http://s1.ticketm.net/dam/a/063/1689bfea-ae98-4c7e-a31d-bbca2dd14063_54361_RECOMENDATION_16_9.jpg", "width": 100, "height": 56, "fallback": false }, { "ratio": "3_2", "url": "http://s1.ticketm.net/dam/a/063/1689bfea-ae98-4c7e-a31d-bbca2dd14063_54361_ARTIST_PAGE_3_2.jpg", "width": 305, "height": 203, "fallback": false }, { "ratio": "16_9", "url": "http://s1.ticketm.net/dam/a/063/1689bfea-ae98-4c7e-a31d-bbca2dd14063_54361_TABLET_LANDSCAPE_16_9.jpg", "width": 2048, "height": 1152, "fallback": false }, { "ratio": "16_9", "url": "http://s1.ticketm.net/dam/a/063/1689bfea-ae98-4c7e-a31d-bbca2dd14063_54361_RETINA_LANDSCAPE_16_9.jpg", "width": 1136, "height": 639, "fallback": false }, { "ratio": "3_2", "url": "http://s1.ticketm.net/dam/a/063/1689bfea-ae98-4c7e-a31d-bbca2dd14063_54361_TABLET_LANDSCAPE_3_2.jpg", "width": 1024, "height": 683, "fallback": false }, { "ratio": "4_3", "url": "http://s1.ticketm.net/dam/a/063/1689bfea-ae98-4c7e-a31d-bbca2dd14063_54361_CUSTOM.jpg", "width": 305, "height": 225, "fallback": false }, { "ratio": "16_9", "url": "http://s1.ticketm.net/dam/a/063/1689bfea-ae98-4c7e-a31d-bbca2dd14063_54361_EVENT_DETAIL_PAGE_16_9.jpg", "width": 205, "height": 115, "fallback": false }, { "ratio": "3_2", "url": "http://s1.ticketm.net/dam/a/063/1689bfea-ae98-4c7e-a31d-bbca2dd14063_54361_RETINA_PORTRAIT_3_2.jpg", "width": 640, "height": 427, "fallback": false }, { "ratio": "16_9", "url": "http://s1.ticketm.net/dam/a/063/1689bfea-ae98-4c7e-a31d-bbca2dd14063_54361_RETINA_PORTRAIT_16_9.jpg", "width": 640, "height": 360, "fallback": false }, { "ratio": "16_9", "url": "http://s1.ticketm.net/dam/a/063/1689bfea-ae98-4c7e-a31d-bbca2dd14063_54361_TABLET_LANDSCAPE_16_9.jpg", "width": 1024, "height": 576, "fallback": false } ], "_links": { "self": { "href": "/discovery/v2/events/k7vGFKzleBdwS/images?locale=en-us" } } } ``` -------------------------------- ### Example Request and Response for Genre Details Source: https://developer.ticketmaster.com/products-and-docs/apis/discovery-api/v2 This shows an example of a GET request for genre details and its corresponding successful HTTP 200 OK response, including the JSON payload with genre information and associated subgenres. ```http GET /discovery/v2/classifications/genres/KnvZfZ7vA71.json?apikey={apikey} HTTP/1.1 Host: app.ticketmaster.com X-Target-URI: https://app.ticketmaster.com Connection: Keep-Alive ``` ```http HTTP/1.1 200 OK Access-Control-Allow-Headers:origin, x-requested-with, accept Access-Control-Allow-Methods:GET, PUT, POST, DELETE Access-Control-Allow-Origin:* Access-Control-Max-Age:3628800 Connection:keep-alive Content-Length:605 Content-Type:application/hal+json;charset=utf-8 Date:Tue, 20 Sep 2016 10:39:15 GMT Rate-Limit:5000 Rate-Limit-Available:1654 Rate-Limit-Over:0 Rate-Limit-Reset:1474384903781 Server:Apache-Coyote/1.1 X-Application-Context:application:local,default,jphx1:8080 X-TM-GTM-Origin:uapi-us-phx2 { "_embedded": { "subgenres": [ { "id": "KZazBEonSMnZfZ7vFta", "name": "Rugby", "_links": { "self": { "href": "/discovery/v2/classifications/subgenres/KZazBEonSMnZfZ7vFta?locale=en-us" } } }, { "id": "KZazBEonSMnZfZ7vFt1", "name": "Rugby League", "_links": { "self": { "href": "/discovery/v2/classifications/subgenres/KZazBEonSMnZfZ7vFt1?locale=en-us" } } }, { "id": "KZazBEonSMnZfZ7vFtJ", "name": "Rugby Union", "_links": { "self": { "href": "/discovery/v2/classifications/subgenres/KZazBEonSMnZfZ7vFtJ?locale=en-us" } } } ] }, "_links": { "self": { "href": "/discovery/v2/classifications/genres/KnvZfZ7vA71?locale=en-us" } }, "id": "KnvZfZ7vA71", "name": "Rugby" } ``` -------------------------------- ### Get Domains List in Ruby Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 This Ruby example uses the RestClient gem to make a GET request to the domains endpoint. Ensure you have the gem installed and are using Ruby 1.9 or later. ```ruby require 'rubygems' if RUBY_VERSION < '1.9' require 'rest_client' headers = { :accept => 'application/json' } response = RestClient.get 'https://app.ticketmaster.eu/mfxapi/v2/domains?country_id', headers puts response ``` -------------------------------- ### Complete ViewController Implementation with Presence SDK Source: https://developer.ticketmaster.com/products-and-docs/sdks/presence-sdk/iOS/index.html This example shows a complete ViewController setup, including IBOutlet, SDK initialization, logout action, and PresenceLoginDelegate conformance. ```swift import PresenceSDK class ViewController: UIViewController { @IBOutlet weak var presenceSDKView: PresenceSDKView? = nil let presenceSDK: PSDK = PSDK.getPresenceSDK() override func viewDidLoad() { super.viewDidLoad() presenceSDK.start(presenceSDKView: presenceSDKView, loginDelegate: self) } @IBAction func logout(_ sender: UIBarButtonItem) { presenceSDK.logOut() } } extension ViewController: PresenceLoginDelegate{ func onLoginSuccessful(backendName: PresenceLogin.BackendName, accessToken: String) { } func onLoginCancelled(backendName: PresenceLogin.BackendName) { } func onMemberUpdated(backendName: PresenceLogin.BackendName, member: PresenceMember) { print("Member Email: \(member.email)") print("Member-Id: \(member.id)") print("CCPA Do Not Sell: \(member.doNotSellFlag)") } func onLogoutAllSuccessful() { } func onLoginFailed(backendName: PresenceLogin.BackendName, error: NSError) } ``` -------------------------------- ### Presence SDK Configuration Example Source: https://developer.ticketmaster.com/products-and-docs/sdks/presence-sdk Example of setting the consumer key and display name for the Presence SDK configuration. ```swift PSDK.shared.setConfig(consumerKey: "AbCdEfG1234567890", displayName: "My App") ``` -------------------------------- ### Get Event Areas using C# HttpClient Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 This C# snippet uses HttpClient to get event area data. Ensure you have installed the Microsoft.Net.Http NuGet package. This example is for non-production use only if consuming a sandbox/test region. ```csharp //Common testing requirement. If you are consuming an API in a sandbox/test region, uncomment this line of code ONLY for non production uses. //System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; //Be sure to run "Install-Package Microsoft.Net.Http" from your nuget command line. using System; using System.Net.Http; var baseAddress = new Uri("https://app.ticketmaster.eu/mfxapi/v2/"); using (var httpClient = new HttpClient{ BaseAddress = baseAddress }) { httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json"); using(var response = await httpClient.GetAsync("events/{event_id}/areas?domain&lang")) { string responseData = await response.Content.ReadAsStringAsync(); } } ``` -------------------------------- ### SportXR Onboarding Steps Source: https://developer.ticketmaster.com/products-and-docs/sdks/presence-sdk/android/index.html Steps to add the Presence SDK to your Android project, configure the manifest, and set the environment and configuration. ```APIDOC ## SportXR Onboarding ### 1. Add SDK Dependency Add the following line to your `build.gradle` (app level) file: ```gradle implementation 'com.ticketmaster.presence:presence:2.xx.xx' ``` (Refer to [https://developer.ticketmaster.com/products-and-docs/sdks/presence-sdk/](https://developer.ticketmaster.com/products-and-docs/sdks/presence-sdk/) for the latest version.) ### 2. Configure Manifest Add the `SportsXRLoginActivity` to your `AndroidManifest.xml`: ```xml ``` ### 3. Set Environment Set the SDK environment using the following code: ```java PresenceSDK.getPresenceSDK(getApplicationContext()).setEnvironment( PresenceSDK.SDKEnvironment.Production, PresenceSDK.HostEnvironment.UK ); ``` ### 4. Set Configuration Configure the SDK with your consumer key and team name: ```java PresenceSDK.getPresenceSDK(getApplicationContext()).setConfig( BuildConfig.CONSUMER_KEY, /* Consumer key provided on dev portal */ BuildConfig.TEAM_NAME, /* your team display name */ BuildConfig.USE_NAM, true, false, PresenceSDK.HostEnvironment.UK ); ``` ``` -------------------------------- ### Fetch Attraction Suggestions with JavaScript (XMLHttpRequest) Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 Use XMLHttpRequest to make a GET request to the Attraction Suggestions endpoint. This example demonstrates basic request setup and response handling. ```javascript var request = new XMLHttpRequest(); request.open('GET', '/attractions/suggestions?attraction_name&lang&domain&has_events'); request.onreadystatechange = function () { if (this.readyState === 4) { console.log('Status:', this.status); console.log('Headers:', this.getAllResponseHeaders()); console.log('Body:', this.responseText); } }; request.send(); ``` -------------------------------- ### Request Example: GET Categories Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 Example HTTP GET request for retrieving categories from the API. ```HTTP GET /categories?lang&domain&category_id&subcategories HTTP/1.1 Host: https://app.ticketmaster.eu/mfxapi/v2 Accept: application/json Content-Length: 0 ``` -------------------------------- ### C# Example for Fetching Attraction Details Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 Demonstrates how to fetch attraction details using HttpClient in C#. Ensure you have the Microsoft.Net.Http NuGet package installed. This example is for non-production use and may require certificate validation callback configuration. ```csharp //Common testing requirement. If you are consuming an API in a sandbox/test region, uncomment this line of code ONLY for non production uses. //System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; //Be sure to run "Install-Package Microsoft.Net.Http" from your nuget command line. using System; using System.Net.Http; var baseAddress = new Uri("https://app.ticketmaster.eu/mfxapi/v2/"); using (var httpClient = new HttpClient{ BaseAddress = baseAddress }) { httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json"); using(var response = await httpClient.GetAsync("attractions/{attraction_id}?lang&domain")) { string responseData = await response.Content.ReadAsStringAsync(); } } ``` -------------------------------- ### Example Request for Sub-Genre Details Source: https://developer.ticketmaster.com/products-and-docs/apis/discovery/v2 This is an example of an HTTP GET request to the Discovery API for sub-genre details. ```http GET /discovery/v2/classifications/subgenres/KZazBEonSMnZfZ7vFta.json?apikey={apikey} HTTP/1.1 Host: app.ticketmaster.com X-Target-URI: https://app.ticketmaster.com Connection: Keep-Alive ``` -------------------------------- ### Swift Example for Fetching Attraction Details Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 Demonstrates fetching attraction details using NSURLSession in Swift. This example sets up the URL, request, and Accept header, then initiates a data task to retrieve and print the response. ```swift // NOTE: Uncommment following two lines for use in a Playground // import XCPlayground // XCPlaygroundPage.currentPage.needsIndefiniteExecution = true let url = NSURL(string: "https://app.ticketmaster.eu/mfxapi/v2/attractions/709593?lang&domain")! let request = NSMutableURLRequest(URL: url) request.addValue("application/json", forHTTPHeaderField: "Accept") let session = NSURLSession.sharedSession() let task = session.dataTaskWithRequest(request) { data, response, error in if let response = response, data = data { print(response) print(String(data: data, encoding: NSUTF8StringEncoding)) } else { print(error) } } ``` -------------------------------- ### Example Request for Segment Details Source: https://developer.ticketmaster.com/products-and-docs/apis/discovery/v2 This shows an example of an HTTP GET request to retrieve segment details, including the host and target URI. ```http GET /discovery/v2/classifications/segments/KZazBEonSMnZfZ7vFta.json?apikey={apikey} HTTP/1.1 Host: app.ticketmaster.com X-Target-URI: https://app.ticketmaster.com Connection: Keep-Alive ``` -------------------------------- ### Example Request for Event Images Source: https://developer.ticketmaster.com/products-and-docs/apis/discovery-manual/v2 This shows an example HTTP GET request for event images, including host and target URI headers. ```http GET /discovery/v2/events/0B004F0401BD55E5/images.json?apikey={apikey} HTTP/1.1 Host: app.ticketmaster.com X-Target-URI: https://app.ticketmaster.com Connection: Keep-Alive ``` -------------------------------- ### Example Discovery API Call with Keyword and Callback Source: https://developer.ticketmaster.com/products-and-docs/apis/getting-started This example shows how to search for events by keyword and specify a callback function for JSONP responses. ```HTTP http://app.ticketmaster.com/discovery/v1/events.json?keyword=Madonna&apikey=4dsfsf94tyghf85jdhshwge334&callback=myFunction ``` -------------------------------- ### C# - Get Countries List Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 Uses HttpClient to make a GET request to the countries endpoint. Ensure you have the Microsoft.Net.Http NuGet package installed. ```csharp //Common testing requirement. If you are consuming an API in a sandbox/test region, uncomment this line of code ONLY for non production uses. //System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; //Be sure to run "Install-Package Microsoft.Net.Http" from your nuget command line. using System; using System.Net.Http; var baseAddress = new Uri("https://app.ticketmaster.eu/mfxapi/v2/"); using (var httpClient = new HttpClient{ BaseAddress = baseAddress }) { httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json"); using(var response = await httpClient.GetAsync("countries?lang&domain")) { string responseData = await response.Content.ReadAsStringAsync(); } } ``` -------------------------------- ### C# - Fetch Attraction Suggestions (async) Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 Use C#'s HttpClient to make an asynchronous GET request to the attraction suggestions endpoint. Ensure the Microsoft.Net.Http NuGet package is installed. ```csharp //Common testing requirement. If you are consuming an API in a sandbox/test region, uncomment this line of code ONLY for non production uses. //System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; //Be sure to run "Install-Package Microsoft.Net.Http" from your nuget command line. using System; using System.Net.Http; var baseAddress = new Uri("https://app.ticketmaster.eu/mfxapi/v2/"); using (var httpClient = new HttpClient{ BaseAddress = baseAddress }) { httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json"); using(var response = await httpClient.GetAsync("attractions/suggestions?attraction_name&lang&domain&has_events")) { string responseData = await response.Content.ReadAsStringAsync(); } } ``` -------------------------------- ### Groovy Example for Fetching Attraction Details Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 Illustrates fetching attraction details using the RESTClient from Groovy's HTTP Builder. This snippet includes dependency grabbing and demonstrates setting headers and printing the response status and body. ```groovy import groovyx.net.http.RESTClient import static groovyx.net.http.ContentType.JSON import groovy.json.JsonSlurper import groovy.json.JsonOutput @Grab (group = 'org.codehaus.groovy.modules.http-builder', module = 'http-builder', version = '0.5.0') def client = new RESTClient("https://app.ticketmaster.eu/mfxapi/v2") def emptyHeaders = [: ] emptyHeaders."Accept" = "application/json" response = client.get( path : "/attractions/{attraction_id}?lang&domain", headers: emptyHeaders ) println("Status:" + response.status) if (response.data) { println("Content Type: " + response.contentType) println("Body:\n" + JsonOutput.prettyPrint(JsonOutput.toJson(response.data))) } ``` -------------------------------- ### Top Picks API Request Example Source: https://developer.ticketmaster.com/products-and-docs/apis/top-picks Example of a GET request to the Top Picks API to retrieve event details with specific query parameters. ```HTTP https://app.ticketmaster.com/top-picks/v1/events/2000527EE48A9334?apikey=GkB8Z037ZfqbLCNtZViAgrEegbsrZ6Ne&areas=10,11&prices=70,150&quantity=4&ticketTypeId=000000000001§ions=103 ``` -------------------------------- ### Fetch Venues using Go Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 Use the standard 'net/http' package to create an HTTP client and send a GET request to the venues endpoint. Set the 'Accept' header to 'application/json'. ```go package main import ( "fmt" "io/ioutil" "net/http" ) func main() { client := &http.Client{} req, _ := http.NewRequest("GET", "https://app.ticketmaster.eu/mfxapi/v2/venues?domain&lang&venuename&venue_ids&city_ids&postal_code&lat&long&radius&sort_by&order&rows&start", nil) req.Header.Add("Accept", "application/json") resp, err := client.Do(req) if err != nil { fmt.Println("Errored when sending request to the server") return } defer resp.Body.Close() resp_body, _ := ioutil.ReadAll(resp.Body) fmt.Println(resp.Status) fmt.Println(string(resp_body)) } ``` -------------------------------- ### Get Domains List in VB.NET Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 This VB.NET example uses WebRequest to fetch domain information. It sets the method to GET and the 'Accept' header to 'application/json'. ```vbnet Dim request = TryCast(System.Net.WebRequest.Create("https://app.ticketmaster.eu/mfxapi/v2/domains?country_id "), System.Net.HttpWebRequest) request.Method = "GET" request.Accept = "application/json" request.ContentLength = 0 Dim responseContent As String Using response = TryCast(request.GetResponse(), System.Net.HttpWebResponse) Using reader = New System.IO.StreamReader(response.GetResponseStream()) responseContent = reader.ReadToEnd() End Using End Using ``` -------------------------------- ### Start Presence SDK in viewDidLoad Source: https://developer.ticketmaster.com/products-and-docs/sdks/presence-sdk/iOS/index.html Initialize the Presence SDK by calling the start method within your ViewController's viewDidLoad lifecycle method. Ensure the presenceSDKView and loginDelegate are correctly provided. ```swift override func viewDidLoad() { super.viewDidLoad() // class variable: let presenceSDK: PSDK = PSDK.getPresenceSDK() presenceSDK.start(presenceSDKView: presenceSDKView, loginDelegate: self) } ``` -------------------------------- ### HTTP Request Example Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 Shows a sample HTTP GET request for event details, including the Host, Accept, and Content-Length headers. ```http GET /events/449621?lang&domain_ids HTTP/1.1 Host: https://app.ticketmaster.eu/mfxapi/v2 Accept: application/json Content-Length: 0 ``` -------------------------------- ### Event Inventory API Request Example Source: https://developer.ticketmaster.com/products-and-docs/apis/partner/availability Example of a GET request to the Event Inventory API, demonstrating how to specify parameters like apikey, limit, and page. ```http https://app.ticketmaster.com/partners/v1/events?apikey=GkB8Z037ZfqbLCNtZViAgrEegbsrZ6Ne&limit=2000&page=2 ``` -------------------------------- ### Objective-C Example for Fetching Attraction Details Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 Provides an example of fetching attraction details using NSURLSession in Objective-C. It configures the request with the correct URL, HTTP method, and Accept header, then handles the response asynchronously. ```objective-c NSURL *URL = [NSURL URLWithString:@"https://app.ticketmaster.eu/mfxapi/v2/attractions/709593?lang&domain"]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL]; [request setHTTPMethod:@"GET"]; [request setValue:@"application/json" forHTTPHeaderField:@"Accept"]; NSURLSession *session = [NSURLSession sharedSession]; NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler: ^(NSData *data, NSURLResponse *response, NSError *error) { if (error) { // Handle error... return; } if ([response isKindOfClass:[NSHTTPURLResponse class]]) { NSLog(@"Response HTTP Status code: %ld\n", (long)[(NSHTTPURLResponse *)response statusCode]); NSLog(@"Response HTTP Headers:\n%@\n", [(NSHTTPURLResponse *)response allHeaderFields]); } NSString* body = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSLog(@"Response Body:\n%@\n", body); }]; [task resume]; ``` -------------------------------- ### VB.NET HTTP GET Request Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 Example of making an HTTP GET request using HttpWebRequest in VB.NET. Sets the 'Accept' header and reads the response stream. ```vbnet Dim request = TryCast(System.Net.WebRequest.Create("https://app.ticketmaster.eu/mfxapi/v2/attractions?domain&lang&attraction_ids&attraction_name&has_events&sort_by&order&rows&start"), System.Net.HttpWebRequest) request.Method = "GET" request.Accept = "application/json" request.ContentLength = 0 Dim responseContent As String Using response = TryCast(request.GetResponse(), System.Net.HttpWebResponse) Using reader = New System.IO.StreamReader(response.GetResponseStream()) responseContent = reader.ReadToEnd() End Using End Using ``` -------------------------------- ### Ruby HTTP GET Request Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 Example of using the 'rest_client' gem in Ruby to make a GET request to the API. Sets the 'Accept' header and prints the response. ```ruby require 'rubygems' if RUBY_VERSION < '1.9' require 'rest_client' headers = { :accept => 'application/json' } response = RestClient.get 'https://app.ticketmaster.eu/mfxapi/v2/attractions?domain&lang&attraction_ids&attraction_name&has_events&sort_by&order&rows&start', headers puts response ``` -------------------------------- ### Partner API Authentication Example Source: https://developer.ticketmaster.com/products-and-docs/apis/partner Demonstrates how to authenticate API requests using an API key. The key can be provided as a query parameter or a header. ```HTTP https://app.ticketmaster.com/partners/v1/events/1AeZZfEGkD0xtGV/cart?apikey=3QIvq55bS608ai6r8moig1WdW57bONry ``` -------------------------------- ### Get Event ID Response Source: https://developer.ticketmaster.com/products-and-docs/apis/partner/availability Example successful response (Status 200) for the Get Event ID endpoint, containing the event's unique ID. ```json { "event" : { "id" : "0B004D43F86C478F" } } ``` -------------------------------- ### Perl HTTP GET Request Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 Example of making a GET request to the API using LWP::UserAgent in Perl. Sets the 'Accept' header and prints the raw response. ```perl require LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->default_header("Accept" => "application/json"); my $response = $ua->get("https://app.ticketmaster.eu/mfxapi/v2/attractions?domain&lang&attraction_ids&attraction_name&has_events&sort_by&order&rows&start"); print $response->as_string; ``` -------------------------------- ### Java: Fetch Search Suggestions with Jersey Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 Example using Jersey client to fetch search suggestions. Requires adding Jersey client dependencies to your pom.xml. ```java // Maven : Add these dependecies to your pom.xml (java6+) // // org.glassfish.jersey.core // jersey-client // 2.8 // // // org.glassfish.jersey.media // jersey-media-json-jackson // 2.8 // import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Entity; import javax.ws.rs.core.Response; import javax.ws.rs.core.MediaType; Client client = ClientBuilder.newClient(); Response response = client.target("https://app.ticketmaster.eu/mfxapi/v2/search/suggestions?domain&query&sort_by&lang&include_packages") .request(MediaType.TEXT_PLAIN_TYPE) .header("Accept", "application/json") .get(); System.out.println("status: " + response.getStatus()); System.out.println("headers: " + response.getHeaders()); System.out.println("body:" + response.readEntity(String.class)); ``` -------------------------------- ### Get Event Seatmap (JavaScript) Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 Use the XMLHttpRequest object to make a GET request to the seatmap endpoint. This example shows how to log the status, headers, and response body. ```JavaScript var request = new XMLHttpRequest(); request.open('GET', 'https://app.ticketmaster.eu/mfxapi/v2/events/449621/seatmap?domain'); request.onreadystatechange = function () { if (this.readyState === 4) { console.log('Status:', this.status); console.log('Headers:', this.getAllResponseHeaders()); console.log('Body:', this.responseText); } }; request.send(); ``` -------------------------------- ### Start Login Flow for Specific Backends Source: https://developer.ticketmaster.com/products-and-docs/sdks/presence-sdk/android/index.html Initiates the login flow for either the HOST or ARCHTICS backend environments. Ensure the appCompatActivity context is correctly provided. ```java // Host example PresenceSDK.startLoginFlow(appCompatActivity, TMLoginApi.BackendName.HOST, MainActivity.this); // Archtics example PresenceSDK.startLoginFlow(appCompatActivity, TMLoginApi.BackendName.ARCHTICS, MainActivity.this); ``` -------------------------------- ### Get Event Details with Ruby Source: https://developer.ticketmaster.com/products-and-docs/apis/international-discovery/v2 Use the 'rest_client' gem to make a GET request to the v2 events endpoint. This example shows how to specify the URL and headers for the request. ```ruby require 'rubygems' if RUBY_VERSION < '1.9' require 'rest_client' headers = { :accept => 'application/json' } response = RestClient.get 'https://app.ticketmaster.eu/mfxapi/v2/events/449621?lang&domain', headers puts response ```