Last Updated on October 10, 2024 by sandeeppote
https://{apiEndpoint}/v2/guests
Request to the api-
Use Client Key in User name and API Token in password to send request with Basic Auth-
Response-
Note ref field. The ref field is a guest reference which can be used further to extend or pull the guests details-
See the Properties tab to verify all the guests details-
cURL code snippet-
curl --location --request POST 'https://api.boxever.com/v2/guests' \
--header 'Authorization: Basic <<Enter Token>>' \
--header 'Content-Type: application/json' \
--data-raw '{
"guestType": "customer",
"title": "Mr",
"firstName": "Icy",
"lastName": "Saber",
"gender": "male",
"dateOfBirth": "",
"emails": [
"icy.saber@mailfy.com"
],
"phoneNumbers": [
"01234567890"
],
"nationality": "British",
"passportNumber": "GB4B9565",
"passportExpiry": "",
"street": [
"Apartment 140",
"West Drive Avenue"
],
"city": "London",
"country": "GB",
"postCode": "SW12",
"state": "London"
}
C# code snippet-
var client = new RestClient("https://api.boxever.com/v2/guests");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Basic <<Enter Token>>");
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@" ""guestType"": ""customer"",
" + "\n" +
@" ""title"": ""Mr"",
" + "\n" +
@" ""firstName"": ""Icy"",
" + "\n" +
@" ""lastName"": ""Saber"",
" + "\n" +
@" ""gender"": ""male"",
" + "\n" +
@" ""dateOfBirth"": """",
" + "\n" +
@" ""emails"": [
" + "\n" +
@" ""icy.saber@mailfy.com""
" + "\n" +
@" ],
" + "\n" +
@" ""phoneNumbers"": [
" + "\n" +
@" ""01234567890""
" + "\n" +
@" ],
" + "\n" +
@" ""nationality"": ""British"",
" + "\n" +
@" ""passportNumber"": ""GB4B9565"",
" + "\n" +
@" ""passportExpiry"": """",
" + "\n" +
@" ""street"": [
" + "\n" +
@" ""Apartment 140"",
" + "\n" +
@" ""West Drive Avenue""
" + "\n" +
@" ],
" + "\n" +
@" ""city"": ""London"",
" + "\n" +
@" ""country"": ""GB"",
" + "\n" +
@" ""postCode"": ""SW12"",
" + "\n" +
@" ""state"": ""London""
" + "\n" +
@"}
" + "\n" +
@"
" + "\n" +
@"";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
Python code snippet-
import http.client
import json
conn = http.client.HTTPSConnection("api.boxever.com")
payload = json.dumps({
"guestType": "customer",
"title": "Mr",
"firstName": "Icy",
"lastName": "Saber",
"gender": "male",
"dateOfBirth": "",
"emails": [
"icy.saber@mailfy.com"
],
"phoneNumbers": [
"01234567890"
],
"nationality": "British",
"passportNumber": "GB4B9565",
"passportExpiry": "",
"street": [
"Apartment 140",
"West Drive Avenue"
],
"city": "London",
"country": "GB",
"postCode": "SW12",
"state": "London"
})
headers = {
'Authorization': 'Basic <Enter Token>>',
'Content-Type': 'application/json'
}
conn.request("POST", "/v2/guests", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Reference-