Back to overview
API Usage Example
Follow the steps below to get started using our API:
Step 1: Authorize using OAuth client credentials flow
This token can be used to access the databases through the api.
Request
POST /token HTTP/1.1
Host: https://content.bookzoapi.nl/v1/token
Content-Type: application/x-www-form-urlencoded
x-subscription-key: your-subscription-key
grant_type=client_credentials
&client_id=your-subscription-key
&client_secret=your-api-key
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://content.bookzoapi.nl/v1/token");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "grant_type=client_credentials&client_id=your-subscription-key&client_secret=your-api-key");
$headers = array();
$headers[] = "Content-Type: application/x-www-form-urlencoded";
$headers[] = "x-subscription-key: your-subscription-key";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://content.bookzoapi.nl/v1/token");
request.Content = new FormUrlEncodedContent(new Dictionary
{
{ "grant_type", "client_credentials" },
{ "client_id", "your-subscription-key" },
{ "client_secret", "your-api-key" }
});
request.Headers.Add("x-subscription-key", "your-subscription-key");
var response = await client.SendAsync(request);
import requests
url = "https://content.bookzoapi.nl/v1/token"
payload = "grant_type=client_credentials&client_id=your-subscription-key&client_secret=your-api-key"
headers = {
"Content-Type": "application/x-www-form-urlencoded",
"x-subscription-key": "your-subscription-key"
}
response = requests.request("POST", url, data=payload, headers=headers)
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6Ij...",
"token_type": "Bearer",
"expires_in": 899,
}
Step 2: Use the obtained access token to make a GET request to /databases
This call shows you the names of the databases
Request
GET /databases HTTP/1.1
Host: https://content.bookzoapi.nl/v1/databases
Authorization: Bearer your-access-token
x-subscription-key: your-subscription-key
$accessToken = "your-access-token";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://content.bookzoapi.nl/v1/databases");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$headers = array();
$headers[] = "Authorization: Bearer $accessToken";
$headers[] = "x-subscription-key: your-subscription-key";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://content.bookzoapi.nl/v1/databases");
request.Headers.Add("Authorization", "Bearer your-access-token");
request.Headers.Add("x-subscription-key", "your-subscription-key");
var response = await client.SendAsync(request);
var content = await response.Content.ReadAsStringAsync();
import requests
url = "https://content.bookzoapi.nl/v1/databases"
headers = {
"Authorization": "Bearer your-access-token",
"x-subscription-key": "your-subscription-key"
}
response = requests.request("GET", url, headers=headers)
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"databases": [
{
"datebaseName": "name1"
},
{
"databaseName": "name2"
}
]
}
Step 3: You're All Set!
Congratulations! You have successfully authorized and made a GET request to /databases
. You now have everything you need to connect to our API.
Explore Swagger Documentation