Creating Portal Leads
danger
Successful requests will count towards your usage and may incur charges. It will also send out any notifications you have set up.
- cURL
- Guzzle PHP
- Fetch Javascript
curl -X POST `https://api.agentresponse.app/api/v1/offices/{YOUR_OFFICE_ID}/portal-leads` \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {YOUR_API_KEY}' \
-d $'{
"type": "Lettings Viewing",
"data": {
"email": "fred.bloggs@example.org",
"name": "Fred Bloggs",
"phone_number": "07700 900077",
"property_address": "123 test street"
}
}'
<?php
// Include Guzzle. If using Composer:
// require 'vendor/autoload.php';
use GuzzleHttp\Pool;
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
$apiToken = "YOUR_API_TOKEN";
$officeId = "YOUR_OFFICE_ID";
$client = new Client();
$request = new Request(
"POST",
"https://api.agentresponse.app/api/v1/offices/{$officeId}/portal-leads",
[
"Authorization" => "Bearer {$apiToken}",
"Content-Type" => "application/json; charset=utf-8"
],
"{\"data\":{\"name\":\"Fred Bloggs\",\"email\":\"fred.bloggs@example.org\",\"phone_number\":\"07700 900077\",\"property_address\":\"123 test street\"},\"type\":\"Lettings Viewing\"}");
$response = $client->send($request);
echo "Response HTTP : " . $response->getStatusCode() . "
";
const apiToken = 'YOUR_API_TOKEN';
const officeId = 'YOUR_OFFICE_ID';
fetch(`https://api.agentresponse.app/api/v1/offices/${officeId}/portal-leads`, {
"method": "POST",
"headers": {
"Authorization": `Bearer ${apiToken}`,
"Content-Type": "application/json; charset=utf-8"
},
"body": "{\"data\":{\"name\":\"Fred Bloggs\",\"email\":\"fred.bloggs@example.org\",\"phone_number\":\"07700 900077\",\"property_address\":\"123 test street\"},\"type\":\"Lettings Viewing\"}"
})
.then((res) => res.text())
.then(console.log.bind(console))
.catch(console.error.bind(console));
Live Editor
Result
Loading...