saurnia
(Salvo)
September 7, 2020, 10:58am
1
Hi,
I would like to rspresent the history of a value through a web page. How can I take these values? Does hdb ++ have a rest API?
I must use Tango Rest API and what parameters should I use?
Should I connect to database directly?
I couldn’t find anything.
Thanks,
Salvo
Hi Salvo,
As far as I know, HDB++ does not have yet a REST API.
I know someone at the ESRF who developed something to display historic values from a set of attributes on a web page.
I think it is currently connecting to the database directly.
Kind regards,
Reynald
saurnia
(Salvo)
September 9, 2020, 3:07pm
3
Thanks for your response.
eGiga2m provide such a service for the MySQL DB
<?php
if (isset($_REQUEST['conf'])) {
if ($_REQUEST['conf']=='config_1') {
define("HOST", "host");
define("USERNAME", "username");
define("PASSWORD", "password");
define("DB", "db");
define("DBTYPE", "hdbpp");
define("LOG_REQUEST", "../../log/hdbpp_1.log");
}
}
else {
define("HOST", "hostname");
define("USERNAME", "username");
define("PASSWORD", "password");
define("DB", "hdbpp");
define("DBTYPE", "hdbpp");
// define("LOG_REQUEST", "../../log/hdbpp.log");
}
This file has been truncated. show original
<?php
// https://stackoverflow.com/questions/48800128/using-php-mysql-how-do-i-free-memory
include './hdbpp_conf.php';
$timezone = date_default_timezone_get();
$protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')? 'https': 'http';
$host = $protocol.'://'.$_SERVER["HTTP_HOST"];
$uri = explode('?', $_SERVER["REQUEST_URI"]);
$host .= strtr($uri[0], array('/lib/service/hdbpp_plot_service.php'=>''));
$state = array('ON','OFF','CLOSE','OPEN','INSERT','EXTRACT','MOVING','STANDBY','FAULT','INIT','RUNNING','ALARM','DISABLE','UNKNOWN');
$bool = array('FALSE','TRUE');
$pretimer = !isset($_REQUEST['no_pretimer']);
$posttimer = !isset($_REQUEST['no_posttimer']);
$no_time = isset($_REQUEST['no_time']);
$db = mysqli_connect(HOST, USERNAME, PASSWORD, DB, PORT);
//$db = mysqli_connect(HOST, USERNAME, PASSWORD);
This file has been truncated. show original
you should configure hdbpp_conf.php according to your installation
the data are exported according to this schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://luciozambon.altervista.org/egiga2m/schemas/plot.json",
"definitions": {
"firstpoint": {
"type": "object",
"properties": {
"x": {
"type": "number",
"description": "requested start timestamp*1000"
},
"y": {
"type": "number"
},
"marker": {
"type": "object",
"properties": {
"symbol": {
"type": "string",
"description": "url(<actual url of prestart image>)"
This file has been truncated. show original
Kind regards,
Lucio