API Integration
Introduction
The dashboards prepared in the Biwee can be integrated within another application. The Biwee Integration API takes care of the mechanism and communication between Biwee and your application.
Display format
For the integration, the dashboards are rendered in HTML format and embedded via an iframe tag. It is then possible to embed them in a website, a web application or a classic application.
A simple example
This example presents the integration of a dashboard within a php application.
1. I create a dashboard in Biwee.
2. After saving it, in the "Share" menu, I check the box "Accessible in API", the API code is no longer grayed out.

3. The specific integration code for this dashboard is presented to me:

4. I copy / paste the php code within my site:
<?php
session_start();
?>
<html>
<head><title>My php application</title></head>
<body>
<h1>My php application</h1>
<h2>I just integrated a dashboard:</h2>
<div style="width:900px; height:800px;">
<?php
// ------- Zone to customize :
$sessionId = session_id() or 'xxxx'; // Replace xxxx with the session Id or the user Id.
// ------- End of zone to customize.
$tokenGUID = file_get_contents('https://www.biwee.fr/Api/GetToken/MyAPIKey/'. $sessionId .'/MyGUID');
$tokenGUID = substr($tokenGUID, 1, -1);
?>
<iframe src="https://www.biwee.fr/Tdb/<?php echo $tokenGUID; ?>" scrolling="no" style="width:100%; height:100%; border:none;">
</iframe>
</div>
</body>
</html>
In this example, I use as session id the one of the php session returned by session_id(). The session id will be used when the user logs out of my application. The same session id must be used for the display of the dashboard and for the closing of the session.
5. I add in my application the logout code prepared by Biwee. This code ensures that when a user of my application logs out, they can no longer access the dashboards.
<?php
// ------- Zone to customize :
$sessionId = session_id() or 'xxxx'; // Replace xxxx with the session Id or Id of the user to disconnect.
// ------- End of zone to customize.
file_get_contents('https://www.biwee.fr/Api/Logout//'. $sessionId);
?>
Result:
Detail of available API methods
GetToken
GET
https://www.biwee.fr/Api/GetToken
Retrieve a dashboard opening token.
Path Parameters
apiKey
String
Your API Key
sessionID
String
ID that can be used to invalidate the token
dashboardGuid
String
Identifier of the dashboard
SQLparameters
String
Possible SQL parameters (Param1=Value1;Param2=Value2)
'3e74dee5-8000-4973-b4a1-e37bda5c1dbc' // example
GetToken
POST
https://www.biwee.fr/Api/GetToken
Retrieve a token by being able to replace the connection string.
Path Parameters
apiKey
String
Your API Key
sessionID
String
ID that can be used to invalidate the token
dashboardGuid
String
Identifier of the dashboard
SQLparameters
String
Possible SQL parameters (Param1=Value1;Param2=Value2)
Headers
Content-Length
String
Content size
Content-Type
String
text/plain
Request Body
Content
String
Connection chain that the connector should use
{
// Response
}
Changing the connection string and adding additional logs
It is possible when calling the API to specify additional elements by sending a serialized JSON object.
This object can contain the following fields:
connectionString
user
organization
customInfo
The "connectionString" field allows you to specify a connection string and therefore to make the dashboard retrieve data from a different location than the one configured in the software.
The "user", "organization", and "customInfo" fields allow additional data to be added to our database for statistical analysis purposes.
This example presents the integration of a dashboard within a php application. This dashboard uses data from a database with a replaced connection string.
Example using part of the code generated from the software:
<?php
// ------- Zone to customize:
$sessionId = session_id(); // Replace the xxxx with the session id or user id.
// ------- End of zone to customize.
// Replace with the desired values
$postData = json_encode(array(
'connectionString' => 'Connection string',
'user' => 'My user',
'organization' => 'My company',
'customInfo' => 'A piece of information'
);
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-Type: application/json',
'content' => $postData
)
);
$context = stream_context_create($opts);
$tokenGUID = file_get_contents('https://www.biwee.fr/Api/GetToken/ MyAPIKey /'. $sessionId .'/MyGUID', false, $context);
$tokenGUID = substr($tokenGUID, 1, -1);
?>
GetDashboard
GET
https://www.biwee.fr/Tdb
Allows to display a dashboard. Can be used as a URL in a browser or in an iframe. By default the background of the page containing the dashboard is white. It is however possible to specify another color.
Path Parameters
token
String
Dashboard opening token
Query Parameters
color
String
Color of the dashboard texts
ex : cyan , $7FFF00
background-color
String
Color of the dashboard texts
ex : cyan , $7FFF00
{
// Response
}
GetToken
POST
https://www.biwee.fr/Api/GetToken
Retrieve a token by being able to replace the connection string with additional logs.
Path Parameters
apiKey
String
Your API Key
sessionID
String
ID that can be used to invalidate the token
dashboardGuid
String
Identifier of the dashboard
SQLparameters
String
Possible SQL parameters (Param1=Value1;Param2=Value2)
Headers
Content-Length
String
Content size
Content-Type
String
application/json
Request Body
Content
object
JSON object that can contain the following fields:
- Connection String
- User
- Organization
- CustomInfo
(Allows for additional data to be added to our database for statistical analysis purposes)
{
// Response
}
Example of embedding in an iframe with background color change:
<iframe src="https://www.biwee.fr/Tdb/<?php echo $tokenGUID; ?>background-color=blue" scrolling="no" style="width:100%; height:100%; border:none;">
</iframe>
Mis à jour
Ce contenu vous a-t-il été utile ?