Hello, i'm trying to figure out how can we call two method in a single API call using file_get_content.
The problem is, i'm trying to fetch all data for device model right now, which work great, but since that logo of brand icon can only be retrieve using getBrand, so i would like to get all this (getBrand and getModel) in this single call.
How can it be achieved ?
Thanks alot.
<?php
// this token is used to authenticate your API request.
// You can get the token on the API page inside your Matomo interface
$token_auth = 'xxxxxxx';
// we call the REST API and request the 100 first keywords for the last month for the idsite=62
$url2 = "https://xxxxxxxxxx";
$url2 .= "?module=API&method=DevicesDetection.getBrand";
$url2 .= "&idSite=2&period=month&date=today";
$url2 .= "&format=JSON&filter_limit=10";
$url2 .= "&token_auth=$token_auth&language=fr";
$fetched2 = file_get_contents($url2);
$content2 = json_decode($fetched2,true);
foreach ($content2 as $row2) {
$countryName2 = htmlspecialchars($row2["label"], ENT_QUOTES, 'UTF-8');
$hits2 = $row2['nb_visits'];
$logo2 = htmlspecialchars($row2["logo"], ENT_QUOTES, 'UTF-8');
print("<tr><td>$logo2 <img src='xxxxxxxx/$logo2'> <b>$countryName2</b></td> <td>$hits2 visite(s)</td><br>\n</tr>");
}
if (!$content2) {
print(" <p class='text-danger'><b>Aucune donn茅es disponible pour le moment.</b><br />Votre site doit avoir 茅t茅 visit茅 pour obtenir des r茅sultats ici-m锚me.</p>");
}
?>
I pay someone who telling me the right way, 20$ by Paypal
Not too sure about it, but it seems like response from the getModel endpoint includes the brand name and the model name.
You are right.
It give brand and model, but not the brand icon...
That's why i need to fetch both...
Thanks
Also for reference you can issue multiple requests in one API call using the API.getBulkRequest method
Hope that helps
Wow, tsteur exactly what i needed.
As i said, i would pay 20$ for code script, so give me your Paypal will transfer 10$ since you provide me the informations.
Please donate it to any organisation of your choice ;)