Buyer data
Integration Examples
To create tickets with the information of the person who bought the ticket in the primary sale, you should use the following endpoint:
- cURL
- Python
- Java
- PHP
Below is an example of how to notify Menta of the issuance of a ticket with the buyer's information in the primary sale, using fictitious data and cURL.
curl -X POST 'https://api.mentatickets.com/v1/tickets'
-H 'Authorization: YOUR_API_KEY'
-H 'Content-Type: application/json'
--data-raw '[
{
"ticketOptionId": "0001",
"showId": "4726",
"externalReferenceEventId": "the-lion-king-broadway",
"buyer": "buyer@emaildomain.com",
"ticketId": "111",
"ticketAccess": {
"type": "OTHER",
"locator": "D02KWWKS029F"
},
"primarySaleBuyerData": {
"firstName": "Juan",
"lastName": "Pérez",
"identificationType": "DNI",
"identificationNumber": "12345678",
"phoneNumber": "+5491123456789"
}
}
]'
Below is an example of how to notify Menta of the issuance of a ticket with the buyer's information in the primary sale, using fictitious data and Python.
import requests
import json
url = "https://api.mentatickets.com/v1/tickets"
headers = {
"Authorization": "YOUR_API_KEY",
"Content-Type": "application/json",
}
ticketOptionId = "0001"
showId = "4726"
externalReferenceEventId = "the-lion-king-broadway"
buyer = "buyer@emaildomain.com"
ticketId = "111"
ticketAccessType = "OTHER"
locator = "D02KWWKS029F"
firstName = "Juan"
lastName = "Pérez"
identificationType = "DNI"
identificationNumber = "12345678"
phoneNumber = "+5491123456789"
data = [
{
"ticketOptionId": ticketOptionId,
"showId": showId,
"externalReferenceEventId": externalReferenceEventId,
"buyer": buyer,
"ticketId": ticketId,
"ticketAccess": {
"type": ticketAccessType,
"locator": locator,
},
"primarySaleBuyerData": {
"firstName": firstName,
"lastName": lastName,
"identificationType": identificationType,
"identificationNumber": identificationNumber,
"phoneNumber": phoneNumber,
}
}
]
response = requests.post(url, headers=headers, data=json.dumps(data))
Below is an example of how to notify Menta of the issuance of a ticket with the buyer's information in the primary sale, using fictitious data and Java.
import okhttp3.*;
import java.io.IOException;
OkHttpClient client = new OkHttpClient();
MediaType JSON = MediaType.get("application/json; charset=utf-8");
String ticketOptionId = "0001";
String showId = "4726";
String externalReferenceEventId = "the-lion-king-broadway";
String buyer = "buyer@emaildomain.com";
String ticketId = "111";
String ticketAccessType = "OTHER";
String locator = "D02KWWKS029F"
String firstName = "Juan"
String lastName = "Pérez"
String identificationType = "DNI"
String identificationNumber = "12345678"
String phoneNumber = "+5491123456789"
String json = String.format("
[
{
"ticketOptionId": "%s",
"showId": "%s",
"externalReferenceEventId": "%s",
"buyer": "%s",
"ticketId": "%s",
"ticketAccess": {
"type": "%s",
"locator": "%s",
},
"primarySaleBuyerData": {
"firstName": "%s",
"lastName": "%s",
"identificationType": "%s",
"identificationNumber": "%s",
"phoneNumber": "%s",
}
}
]
", ticketOptionId, showId, externalReferenceEventId, buyer, ticketId, ticketAccessType, locator, status, firstName, lastName, identificationType, identificationNumber, phoneNumber);
RequestBody body = RequestBody.create(JSON, json);
Request request = new Request.Builder()
.url("https://api.mentatickets.com/v1/tickets")
.post(body)
.addHeader("Authorization", "YOUR_API_KEY")
.addHeader("Content-Type", "application/json")
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
} catch (IOException e) {
e.printStackTrace();
}
Below is an example of how to notify Menta of the issuance of a ticket with the buyer's information in the primary sale, using fictitious data and PHP.
<?php
$url = "https://api.mentatickets.com/v1/tickets";
$headers = array(
"Authorization: YOUR_API_KEY",
"Content-Type: application/json",
);
$data = array(
array(
"ticketOptionId" => "0001",
"showId" => "4726",
"externalReferenceEventId" => "the-lion-king-broadway",
"buyer" => "buyer@emaildomain.com",
"ticketId" => "111",
"ticketAccess" => array(
"type" => "OTHER",
"locator" => "D02KWWKS029F",
),
"primarySaleBuyerData" => array(
"firstName" => "Juan",
"lastName" => "Pérez",
"identificationType" => "DNI",
"identificationNumber" => "12345678",
"phoneNumber" => "+5491123456789",
)
)
);
$json_data = json_encode($data);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
JSON Response
{
"status": 200,
"data": [{TICKETDATA}],
"errors": null
}
For more detailed information about tickets and buyer information, please refer to the section on ticket data