Skip to main content

Sending Request

Sending Requests

When sending api request, we should provide an API Token

Received API token can be used in 2 places: in header using "Authorization":"Bearer {token}" or just by adding token={token} parameter to requests. Below will be provided 2 examples.

Using Authorization header

<?php
// Laravel framework example
use Illuminate\Support\Facades\Http;
// ...

$businessPageRequest = Http::withHeaders([
'Authorization' => 'Bearer eyJpdiI6Ijl5T29nMFF5SEFibXhIUXNTYjFyU2c9PSIsInZhbHVlIjo'])
->post('https://blt.brownbook.net/api/tenant/pages', [
"name" => "Brownbook.net",
"address" => "80 East Street, Brighton",
"country" => "UK",
"phone" => "16463245332",
"email" => "admin@brownbook.net",
"business_hours" => "admin@brownbook.net",
"description" => "Brownbook.net is the free Global Business Listing Database that anyone can edit.",
"user" => [
"full_name" => "John Doe",
"username" => "John.doe",
"email" => "john_doe@gmail.com",
"country_code" => "US",
"avatar" => "https://i.pravatar.cc/300",
"mobile_phone" => "16465553890"
]
]);
$response = $businessPageRequest->json();

Using parameter

<?php
// Laravel framework example
use Illuminate\Support\Facades\Http;

$businessPageRequest = Http::post('https://blt.brownbook.net/api/tenant/pages', [
"name" => "Brownbook.net",
"address" => "80 East Street, Brighton",
"country" => "UK",
"phone" => "16463245332",
"email" => "admin@brownbook.net",
"business_hours" => "admin@brownbook.net",
"description" => "Brownbook.net is the free Global Business Listing Database that anyone can edit.",
"user" => [
"full_name" => "Jane Doe",
"username" => "Jane.doe",
"email" => "jane_doe@gmail.com",
"country_code" => "US",
"avatar" => "https://i.pravatar.cc/300",
"mobile_phone" => "16465553890"
],
"token":"eyJpdiI6Ijl5T29nMFF5SEFibXhIUXNTYjFyU2c9PSIsInZhbHVlIjo"
]);
$response = $businessPageRequest->json();