Question about http api

karen

Member
Hi, I have my application working, it's exactly what we need.. my next question is about further customisation.
If we upgrade to Platinum and using the api, is it possible to create a separate website and pull data fields into a specific template in a "mail merge" sort of way?

For example, on the website may be an image, say a diagram of a car, then on the diagram, the field "tyre_size" would appear on the tyre, the field "engine_size" would show on the image where the engine would be, and so on? (image example idea attached)
Also, the website would be on the same url as where dadabik is installed, would that work ok?
Thank you.
 

Attachments

  • examplecar.png
    examplecar.png
    365 KB · Views: 1

eugenio

Administrator
Staff member
Hi,
with HTTP API you can, from the other website, retrieve data from DaDaBIK (but you could also select the data directly from the DB). Then you have to produce the final image using the template and the data you got: you can do this in PHP, google PHP create image and you will find many tutorials.

About being on the same URL, I guess you mean on the same domain? If this is what you mean, yes, they can live on the same domain.

Best,
 

karen

Member
Hi sorry yes, I meant on the same domain.
So, to pull the fields as I require, I would just need the api "connection" to the database and then using php for my template, I could just add the fields from the table in the position they are required?
Would it be made in a similar way to the pdf template?
Thanks
 

eugenio

Administrator
Staff member
No, it's not like PDF template. PDF templates is a feature provided by DaDaBIK, there is no "image template" feature provided by DaDaBIK, you have to create the picture and add the data using your own code.
 

karen

Member
Hi sorry, I meant the way you can create the layout, by adding the fields in custom positions, for example. something like this:

PHP:
$sql = "SELECT make, model, tyre_size, engine_size FROM cars";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // Output data of each row
    while($row = $result->fetch_assoc()) {
        echo "<div><b>Make:</b> " . $row["make"] . "</div>";
        echo "<div><b>Model:</b> " . $row["model"] . "</div>";
        echo "<div><b>Tyre Size:</b> " . $row["tyre_size"] . "</div>";
        echo "<div><b>Engine Size:</b> " . $row["engine_size"] . "</div>";
    }
} else {
    echo "0 results";
}

I just mean, can you use the fields, and put them in any position, not in a grid layout like it already is?
Thanks.
 

eugenio

Administrator
Staff member
I don't understand your question. I think we are talking about a distinct (non dadabik) application, getting data from a DaDaBIK application via HTTP API. Once you have the data you can do whatever you want, it's just your own PHP code, DaDaBIK is not involved anymore.
 

karen

Member
Hi Eugenio, yes thanks, that has answered my question. I wasn't sure if when the data was received from DaDaBIK, whether it could be formatted as required, or whether it would look the same as (in a grid or list) but on a custom web page. I understand now thanks.
 
Top