POST https://login.hero-software.de/api/v1/Projects/create
Authorization: Bearer YOUR\_API\_KEY
Content-Type: application/json
Accept: application/json
Authorization: Bearer [dein-api-token]
json
{
"measure": "PVS",
"customer": { ... },
"address": { ... },
"projectaddress": { ... },
"project": { ... },
"project\_match": { ... },
"images": \[ ... ],
"documents": \[ ... ]
}
Beispiel:
json
"customer": {
"email": "max.mustermann@example.com",
"first\_name": "Max",
"last\_name": "Mustermann",
"title": "Herr",
"phone\_home": "+4921112345678",
"phone\_mobile": "+49171123456"
}
Beispiel:
json
"address": {
"street": "Musterstraße 42",
"zipcode": "10115",
"city": "Berlin",
"country\_code": "DE"
}
Beispiel:
json
"projectaddress": {
"street": "Gewerbepark 1",
"zipcode": "80331",
"city": "München",
"country\_code": "DE"
}
Beispiel:
json
"project": {
"source": "mein-portal.de - Angebotsanfrage",
"source\_sub": "mein-portal.de",
"source\_medium": "Angebotsanfrage",
"lead\_id": "MeinPortal/abc123"
}
Beispiel:
json
"project\_match": {
"status\_code": 201,
"comment": "Kunde hat über unser Portal angefragt.",
"inform\_partner": true
}
json
{
"measure": "PVS",
"customer": {
"email": "anna.schmidt@example.com",
"first\_name": "Anna",
"last\_name": "Schmidt",
"title": "Frau",
"phone\_home": "+4930123456",
"phone\_mobile": "+49170987654"
},
"address": {
"street": "Hauptstraße 10",
"zipcode": "10117",
"city": "Berlin",
"country\_code": "DE"
},
"project": {
"source": "solarvergleich.de - Anfrageformular",
"source\_sub": "solarvergleich.de",
"source\_medium": "Anfrageformular",
"lead\_id": "solarvergleich/XY789"
},
"project\_match": {
"status\_code": 201,
"comment": "Interesse an 10 kWp Anlage mit Speicher.",
"inform\_partner": true
},
}
json
{
"status": "success",
"id": 12345
}
json
{
"status": "error",
"message": "Fehlende Postleitzahl",
"validationErrors": {}
}
<?php
$url = 'https://login.hero-software.de/api/v1/Projects/create';
$apikey = 'YOUR\_API\_KEY'; // den API-Schlüssel bekommst du von unserem Support
$data = array(
"measure" => "PRJ",
"customer" => array(
"email" => "max.mustermann@example.org",
"title" => "Herr",
"first\_name" => "Max",
"last\_name" => "Mustermann",
"company\_name" => "Meine Firma",
),
"address" => array(
"street" => "Schwarzer Bär 2",
"city" => "Hannover",
"zipcode" => "30449",
"country\_code" => "DE",
),
"projectaddress" => array(
"street" => "Schwarzer Bär 5",
"city" => "Hannover",
"zipcode" => "30449",
"country\_code" => "DE",
),
"project\_match" => array(
"comment" => "Dieser Kommentar erscheint im Logbuch zu dem Projekt.",
"partner\_notes" => "Optionale Hinweise für das Notizfeld.",
"partner\_source" => "Mein Kontaktformular",
),
);
$postdata = json\_encode($data);
$ch = curl\_init($url);
curl\_setopt($ch, CURLOPT\_POST, 1);
curl\_setopt($ch, CURLOPT\_POSTFIELDS, $postdata);
curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, 1);
curl\_setopt($ch, CURLOPT\_HTTPHEADER, array(
'Content-Type: application/json',
'Accept: application/json',
'Authorization: Bearer '.$apikey,
));
$result = curl\_exec($ch);
curl\_close($ch);
$response = json\_decode($result, true);
if (isset($response\['status']) \&\& $response\['status'] == 'success') {
echo "Projekt erfolgreich angelegt";
} else {
echo "Ein Fehler ist aufgetreten: ".$response\['message']."
\\n";
var\_dump($response);
}
Noch Fragen?
Du hast noch Fragen zur HERO Lead API? Gern kannst du dich direkt an uns wenden. Hier findest du alle Kontaktmöglichkeiten.
Das könnte dich auch interessieren