Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Funktionen auslesen #9

Closed
DanielNe opened this issue Nov 15, 2017 · 4 comments
Closed

Funktionen auslesen #9

DanielNe opened this issue Nov 15, 2017 · 4 comments

Comments

@DanielNe
Copy link

Gibt es eine Möglichkeit die Funktionen über das API auszulesen?
Vielen Dank!
MfG
Daniel

@pmig
Copy link
Contributor

pmig commented Dec 1, 2017

Hallo Daniel,

Sry für die späte Antwort, wir haben nun auch die Funktionen über die API freigeschalten.

Ich füge sie gleich zu den docs hinzu.

Beste Grüße, Philip

@pmig pmig closed this as completed in 1b49fc1 Dec 1, 2017
@19flashover69
Copy link

19flashover69 commented Jan 14, 2018

Hallo!
Leider erhalte ich beim auslesen der Funktion einen Fehler - Anscheinend kennt er die Variable nicht oder hab ich einen Denkfehler?!

<?php
const DASHBOARD_BASE_URL = 'https://api.blaulichtsms.net/blaulicht/api/alarm/v1/dashboard/';
// FILL IN THE SESSION ID BELOW
const DASHBOARD_URL = DASHBOARD_BASE_URL . SESSION_ID;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, DASHBOARD_URL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$curlResponse = curl_exec($ch);
curl_close($ch);
$dashboardResult = json_decode($curlResponse);

foreach ($dashboardResult->alarms as $alarm) {
    echo("<b> <u>Alarm:</u> $alarm->alarmText </b><br>");
   
foreach ($alarm->recipients as $recipient) {
        echo("Name: $recipient->name <br> Status: $recipient->participation <br> Antwortnachricht: $recipient->functions <br><br>");

foreach ($alarm->functions as $functions) {
        echo("Name: $functions->name ");

    }
    echo("<hr>");
}}
?>

Gibt es auch eine Möglichkeit, die Rückmeldungen der Mitglieder zu sortieren? In Ja, Nein usw.

Lg

@pmig
Copy link
Contributor

pmig commented Jan 15, 2018

Hallo @19flashover69

Die Funktionen hängen nicht direkt am Alarm, sondern wir liefern die Liste der Funktionen für jeden Teilnehmer mit aus. Folgender Code würde funktionieren:

foreach ($alarm->recipients as $recipient) {
    echo("Name: $recipient->name <br> Status: $recipient->participation <br> Antwortnachricht: 
    $recipient->participationMessage <br><br>");
    foreach ($recipient->functions as $function) {
        echo("Funktion: $function->name ");
    }
    echo("<hr>");
}

Bzgl. der Sortieren, könntest du zum Beispiel die PHP Funktion array_multisort verwenden.

Beste Grüße,
Philip

@19flashover69
Copy link

19flashover69 commented Jan 15, 2018

Dankesehr :-)

Kann BlaulichtSMS eigentlich unterscheiden ob ein Einsatz bereits beendet wurde?

Lg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants