Webhook User Update
Mit diesem Webhook können Daten eines Event-Besucher aktualisiert werden.
URL zum Update von Userdaten
https://<messename>.expo-ip.com/api/user/update/[userid]
HTTP HEADER
Key | Type | Required | Option |
---|---|---|---|
X-API-KEY | string | yes |
POST Parameter
Key | Subkey | Type | Required | Option |
---|---|---|---|---|
User | array | yes | ||
firstname | string | no | ||
lastname | string | no | ||
string | no | |||
title | string | no | ||
salutation | integer | no | 1 = Herr / Mr.2 = Frau / Mrs.3 = divers / other4 = unbekannt / unknown | |
password | string | no | ||
login_hash | sting | no | ||
timezone | srtring | no | https://www.php.net/manual/de/timezones.php | |
CustomFieldUser | array | no | ||
ID -> ‘value’ | Beispiel in PHP:$data['CustomFiledUser'][1]['value'] = 'My Company'; Die Werte für die IDs sind abhängig von den in der Messe angelegten CustomFileds. |
Die Struktur des CustomFieldUser [Array]
[
id =>
[
value => [string | id]
]
]
Return Values
Wenn API Key fehlerhaft: HTTP/1.1 404 Not Found
Wenn API Key korrekt im JSON Format (Beispiel):
{
„success“:“1″,
„resultMessage“:“UpDate erfolgreich“
}
Beispiel:
Die Daten des User mit der UserId 6568 sollen mit folgenden Werten belegt werden:
firstname= „Max“
lastname= „Muster“
email= „max@muster.de“
salutation = 1 (Mann / Mr.)
Firmenname im CustomFieldUser [64] = „Expo-IP GmbH“
Auswahlfeld im CustomFieldUser [82] = 1
In JSON sieht die Struktur z.B. so aus:
{
"User": {
"firstname" : "Alice",
"lastname" : "Test",
"email" : "alice@expo-ip.com",
"salutation" : "2",
"CustomFieldUser": {
"1": {"value": "My Company"},
"2": {"value": "1"},
"3": {"value": "VIP"},
"4": {"value": "1"}
}
}
}
Beispielcode für das UpDate von Benutzerdatenin PHP:
// MESSENAME durch den tatsächlichen Namen der Messe ersetzen:
$userId = 6568;
$strTargetURL = 'https://MESSENAME.expo-ip.com/api/user/update/' . $userId;
// API Key hier einsetzen
$apiKey = 'aaaaXXXXaaaaXXXXaaaaXXXX';
// Die zu sendenden Daten
$arrUserdata = [
'User' => [
'email' => 'max@muster.de',
'firstname' => 'Max',
'lastname' => 'Muster',
'salutation' => 1,
'title' => 'Dr.',
'timezone' => 'Europe/Berlin',
],
'CustomFieldUser' => [
64 => [
'value' => 'Expo-IP GmbH'
],
82 => [
'value' => '1'
]
]
];
$ch = curl_init($strTargetURL);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-API-KEY: " . $apiKey));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($arrUserdata) );
curl_setopt($ch, CURLOPT_VERBOSE, '1');
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
if( ! $result = curl_exec($ch)) {
die('Ein Fehler ist aufgetreten: ' . curl_error($ch));
}
print 'Antwort vom Server:';
print $result;
Die IDs bei CustomFieldUser sind abhängig von den bei der Messe eingerichteten Custom Fields.
Der Webhook sendet ein Ergebnis im JSON Format zurück, z.B.
{
"success":"1",
"resultMessage":"UpDate erfolgreich"
}