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

As Municipality of Bolzano, I would like to get again real-time data of the Parking Laurin infrastructure #685

Open
rcavaliere opened this issue Feb 12, 2025 · 10 comments
Assignees

Comments

@rcavaliere
Copy link
Member

rcavaliere commented Feb 12, 2025

This parking station is present since long time ago, but due to technical reasons, the parking API provided by the Municipality of Bolzano (Famas System) does not provide real-time data since long time now.

There is now a "direct" channel for this, i.e. use the Skidata API, but with a different end-point, which is: https://www.mybestinparking.it/api/Facility/GetFreePlaces?FacilityID=406983&CountingCategoryNo=3

The credentials are exactly the same as for the other Data Collector implemented.

Please ensure that the real-time data provided is assigned to the existing parking station available in the Open Data Hub.

@Luscha
Copy link

Luscha commented Feb 13, 2025

I'm having difficulties in identifying the old data collector i need to migrate to the new endpoint and the credentials needed for the authentication.
Can you provide more information about the origin and StationTypes we are referring to?

@rcavaliere
Copy link
Member Author

@Luscha the previous Data Collector in which we had this parking station is this one: https://github.com/noi-techpark/bdp-commons/tree/main/data-collectors/parking-offstreet-meranobolzano (2. Parking slot data from FAMAS)

The parking station is this one, all data types are affected, except for the ones we consider for our elaborations, e.g forecasts

Image

@Luscha
Copy link

Luscha commented Feb 17, 2025

Thank you Roberto, the only thing i need more information about are the credentials.
You mentioned we should use https://www.mybestinparking.it/api/Facility/GetFreePlaces?FacilityID=406983&CountingCategoryNo=3 endpoint with the same credentials as for the other collector. Which collector and credentials are you talking about? i Tried to use Skidata's credentials found in the parking-offstreet-sta collector, but it doesn't seems to work. am i missing something bout your original post where "Skidata" endpoints are mentioned?

@rcavaliere
Copy link
Member Author

@Luscha yes, you should use that credentials, username = [email protected]. Can you confirm?

@Luscha
Copy link

Luscha commented Feb 17, 2025

Trying to query the endpoint https://www.mybestinparking.it/api/Facility/GetFreePlaces?FacilityID=406983&CountingCategoryNo=3 including the access_token got from the authentication (oauth) against https://www.onecenter.info/oauth/token (Skidata oauth endpoint) I'm still getting the login page as response.

Just to be sure i'm following the right process, i followed the skidata documentation at https://github.com/noi-techpark/bdp-commons/blob/main/data-collectors/parking-offstreet-sta/documentation/230728_SpecificaSkidata.pdf. After getting the token using the credentials username = [email protected] i use it to get data from the provided url (https://www.mybestinparking.it/api/Facility/GetFreePlaces?FacilityID=406983&CountingCategoryNo=3).

@rcavaliere
Copy link
Member Author

@Luscha yes, you are doing all right. Can you provide me a screenshot of this login page? I think we had a similar issue we had in the past with this supplier...

@Luscha
Copy link

Luscha commented Feb 18, 2025

Api call:

GET https://www.mybestinparking.it/api/Facility/GetFreePlaces?FacilityID=406983&CountingCategoryNo=3
Authorization: Bearer {{login.response.body.access_token}}

result:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Log in  - Best in Parking &amp; Real Estate AG</title>
    <link href="/Content/css?v=4" rel="stylesheet"/>

    <link href="/Content/jquery-ui.css?v=1" rel="stylesheet"/>

    <link href="/Scripts/IntlTelInput/css/intlTelInput.min.css" rel="stylesheet"/>

    <script src="/bundles/modernizr?v=inCVuEFe6J4Q07A0AcRsbJic_UE5MwpRMNGcOtk94TE1"></script>

    <script src="/bundles/jquery?v=235DeCRyc2KKtm5-u-WowaGmWHU3ft44y448NxHpMf41"></script>

    <script src="/bundles/bootstrap?v=M4Nk6kIOwMFflsEKET0iPL9i5YBqbzMzvUOrd8gyCnw1"></script>

    <script src="/bundles/jqueryval?v=mmuXN4YlobxCcBxb9f4QBT6Gqk7hoEGcsT1gulUOoSY1"></script>

    <script type="text/javascript" src="/Scripts/jquery-ui-1.12.1.min.js"></script>
    <script type="text/javascript" src="/Scripts/cookie.js"></script>
    <script type="text/javascript" src="/Scripts/IntlTelInput/js/intlTelInput-jquery.min.js"></script>
    <script defer src="/Content/fontawesome/js/all.js"></script>
    <link rel="manifest" href="/manifest.json">
    <script type="text/javascript" src="/Scripts/moment-with-locales.min.js"></script>
</head>
<body>
    
    <!-- Cookie Consent by TermsFeed https://www.termsfeed.com/ -->
    <script type="text/javascript" src="https://www.termsfeed.com/public/cookie-consent/4.1.0/cookie-consent.js" charset="UTF-8"></script>
    <script type="text/javascript" charset="UTF-8">
        document.addEventListener('DOMContentLoaded', function () {
            cookieconsent.run({ "notice_banner_type": "simple", "consent_type": "express", "palette": "light", "language": "en", "page_load_consent_levels": ["strictly-necessary"], "notice_banner_reject_button_hide": false, "preferences_center_close_button_hide": false, "page_refresh_confirmation_buttons": false, "website_privacy_policy_url": "https://www2.mybestinparking.it/Docs/GDPR.pdf" });
        });
    </script>

    <noscript>Free cookie consent management tool by <a href="https://www.termsfeed.com/">TermsFeed</a></noscript>
    <!-- End Cookie Consent by TermsFeed https://www.termsfeed.com/ -->
    <!-- Below is the link that users can use to open Preferences Center to change their preferences. Do not modify the ID parameter. Place it where appropriate, style it as needed. -->

    <a href="#" id="open_preferences_center">Update cookies preferences</a>

    



    <div id="overlay">
        <div class="loading">Caricamento in corso...</div>
    </div>

    
    

    <div class="navbar navbar-inverse navbar-fixed-top">
        <div style="border-bottom:2px solid white;">
            <div class="container">
                <div class="navbar-left">
                    <div>
                        <a href="/" alt="Best In Parking - Holding AG">
                            <img src="/Content/images/logo.png" class="logo" />
                        </a>
                    </div>
                </div>
                <div class="navbar-right">
                    


    <ul class="nav navbar-nav navbar-right">
        <li class="hidden-xs ">
            <a href="/System/ChangeCulture?value=it&amp;returnUrl=%2FAccount%2FLogin%3FReturnUrl%3D%252Fapi%252FFacility%252FGetFreePlaces%253FFacilityID%253D406983%2526CountingCategoryNo%253D3"><img src="/Content/Images/icon_Italy.png" class="img-responsive"></a>
        </li>
        <li class="hidden-xs active">
            <a href="/System/ChangeCulture?value=en&amp;returnUrl=%2FAccount%2FLogin%3FReturnUrl%3D%252Fapi%252FFacility%252FGetFreePlaces%253FFacilityID%253D406983%2526CountingCategoryNo%253D3"><img src="/Content/Images/icon_UK.png" class="img-responsive"></a>
        </li>
        <li><a href="/Account/Register" id="registerLink">Register</a></li>
        <li><a href="/Account/Login" id="loginLink">Login</a></li>
    </ul>

                </div>
            </div>
        </div>
        
        <div class="container">
            <div class="col-xs-4 hidden-md hidden-lg hidden-sm">
                <ul class="navbar-left list-inline">
                    <li class="">
                        <a href="/System/ChangeCulture?value=it&amp;returnUrl=%2FAccount%2FLogin%3FReturnUrl%3D%252Fapi%252FFacility%252FGetFreePlaces%253FFacilityID%253D406983%2526CountingCategoryNo%253D3"><img src="/Content/Images/icon_Italy.png" class="img-responsive"></a>
                    </li>
                    <li class="active">
                        <a href="/System/ChangeCulture?value=en&amp;returnUrl=%2FAccount%2FLogin%3FReturnUrl%3D%252Fapi%252FFacility%252FGetFreePlaces%253FFacilityID%253D406983%2526CountingCategoryNo%253D3"><img src="/Content/Images/icon_UK.png" class="img-responsive"></a>
                    </li>
                </ul>
            </div>
            <div class="col-xs-8 col-md-12 cik-lg-12 col-sm-12 navbar-right">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>

                <div class="collapse navbar-collapse">
                    <ul class="nav navbar-nav">
                            <li><a href="/">Home</a></li>
                            <li><a href="/Home/CookiePolicy">Privacy &amp; Cookie Policy</a></li>
                            <!--<li><a href="/Calendar/Appointment">Appointment</a></li>-->
                            <!--<li><a href="/Home/About">About</a></li>-->
                            <li><a href="/Home/Contact">Contact</a></li>
                            <li><a href="/Home/Tariffs">Tariffs</a></li>
                            <li><a href="/Home/Support">Support</a></li>
                            <li><a href="/Home/FAQ">FAQ</a></li>
                    </ul>
                </div>
            </div>
        </div>
        
        <div id="mainReleaseBanner"></div>
    </div>
    <div class="container body-content wrapper">
        <div class="row">
            <div class="col-md-12">
                
            </div>
        </div>
        <div class="row">
            <div class="col-md-12">
                

<h2>Log in</h2>
<div class="form-horizontal">
    <section id="loginForm" class="col-md-12">
<form action="/Account/Login?ReturnUrl=%2Fapi%2FFacility%2FGetFreePlaces%3FFacilityID%3D406983%26CountingCategoryNo%3D3" class="form-horizontal" method="post" role="form"><input name="__RequestVerificationToken" type="hidden" value="FYCbVnh_xk7_hFGXF-7_NgyyceAUVut3Unl3WosA4-gg2M3HV-Wv5QTnlHGNIepl0B18LYnCHZ1xfvkVGR-8d4tZEXSw0azj7z_vgPW6qrM1" />            <h4>Use a local account to log in.</h4>
            <div class="form-group">
                <div class="col-md-8">
                    
<div class="form-group required">
    <label class="col-md-7 control-label" for="Email">EMail</label>
    <div class="col-md-8">
        <input class="form-control" data-val="true" data-val-email="The EMail field is not a valid e-mail address." data-val-required="The field EMail is required" id="Email" name="Email" type="text" value="" />
        <span class="field-validation-valid text-danger" data-valmsg-for="Email" data-valmsg-replace="true"></span>
    </div>
</div>
<div class="form-group required">
    <label class="col-md-7 control-label" for="Password">Password</label>
    <div class="col-md-8">
        <input class="form-control" data-val="true" data-val-required="The field Password is required" id="Password" name="Password" type="password" />
        <span class="field-validation-valid text-danger" data-valmsg-for="Password" data-valmsg-replace="true"></span>
    </div>
</div>
                </div>
                <div class="col-md-8">
                    <div class="checkbox">
                        <input data-val="true" data-val-required="The Remember me field is required." id="RememberMe" name="RememberMe" type="checkbox" value="true" /><input name="RememberMe" type="hidden" value="false" />&nbsp;<b><label for="RememberMe">Remember me</label></b>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-8">
                    <input type="submit" value="Log in" class="btn btn-primary" />
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-8">
                    <a class="btn btn-warning" href="/Home/FAQ">Help me!</a><br />
                </div>
            </div>
            <div style="clear:both;"></div>
            <p>
                <b><a href="/Account/Register">Register</a></b><br />
                <b><a href="/Account/ForgotPassword">Forgot password</a></b><br />
                <b><a href="/Account/RecoverAccount">Recover account</a></b><br />
            </p>
</form>    </section>
    
</div>



            </div>
        </div>
    </div>

    <div class="push"></div>

    <div class="footer">
        
    <div style="text-align:center; font-size:smaller">
        <hr />
        <p>
            
            <b>Best in Parking & Real Estate AG</b>
<br />
Schwarzenbergplatz 5 / 7.1  – 1030 Vienna (Austria) <b>T:</b> +43 1 513 12 41 <b>F:</b> +43 1 513 83 63 <b>E:</b> [email protected] <b>W:</b> www.bestinparking.com <b>FB:</b> FN284389w <b>UID:</b> ATU66095922.
        </p>
    </div>
        <div class="col-md-12 text-center">
            <button class="add-button btn btn-default" style="display:none">Add to home screen</button>
        </div>
    </div>

    
    <script src="/bundles/jqueryval?v=mmuXN4YlobxCcBxb9f4QBT6Gqk7hoEGcsT1gulUOoSY1"></script>


    

<script>
        // DM INIZIO BLOCCO BACK BROWSER
        $(document).ready(function () {

            window.history.pushState(null, "", window.location.href);

            window.onpopstate = function () {

                window.history.pushState(null, "", window.location.href);

            };

            CheckMaintenance();
            setInterval(CheckMaintenance, 60000);

        });
        // DM FINE BLOCCO BACK BROWSER

    $(document).on('contextmenu', function (event) {
        event.preventDefault();
    });

    // Blocca il tocco prolungato su mobile
    $(document).on('touchstart', function (event) {
        if (event.touches.length > 1) {
            event.preventDefault();
        }
    });
    $(document).on('touchend', function (event) {
        if (event.touches.length > 1) {
            event.preventDefault();
        }
    });

        if ('serviceWorker' in navigator) {
            window.addEventListener('load', function () {
                navigator.serviceWorker.register('/worker.js').then(function (registration) {
                    //console.log('Worker registration successful', registration.scope);

                }, function (err) {
                    console.error('Worker registration failed', err);
                }).catch(function (err) {
                    console.error(err)
                });
            });
        } else {
            console.log('Service Worker is not supported by browser.');
        }

        let deferredPrompt;
        const addBtn = document.querySelector('.add-button');
        addBtn.style.display = 'none';

        window.addEventListener('beforeinstallprompt', (e) => {
            // Prevent Chrome 67 and earlier from automatically showing the prompt
            e.preventDefault();
            // Stash the event so it can be triggered later.
            deferredPrompt = e;
            // Update UI to notify the user they can add to home screen
            addBtn.style.display = 'inline-block';

            addBtn.addEventListener('click', (e) => {
                // hide our user interface that shows our A2HS button
                addBtn.style.display = 'none';
                // Show the prompt
                deferredPrompt.prompt();
                // Wait for the user to respond to the prompt
                deferredPrompt.userChoice.then((choiceResult) => {
                    if (choiceResult.outcome === 'accepted') {
                        console.log('User accepted the A2HS prompt');
                    } else {
                        console.log('User dismissed the A2HS prompt');
                    }
                    deferredPrompt = null;
                });
            });
        });

        function CheckMaintenance() {
            var vpath = "/";
            vpath = vpath == "/" ? vpath : vpath + "/";

            $.ajax({
                url: vpath + "System/GetUnderMaintenanceStatus",
                type: "GET",
                datatype: "json",
                async: true
            }).done(function (ret) {
                if (ret != null) {
                    if (ret.ShowMaintenancePage)
                        location.href = "/UnderMaintenance.html";
                    else {
                        if (ret.ShowBanner) {
                            var dateformat = "DD/MM/YYYY";
                            var currCult = "en";
                            if (currCult == "en")
                                dateformat = "MM/DD/YYYY";

                            var startdate = moment(ret.ReleaseStartDate);
                            var enddate = moment(ret.ReleaseEndDate);

                            var warningStr = "<b>Scheduled Maintenance:</b> The application will be undergoing scheduled maintenance from <b>[STARTHOUR]</b> on <b>[STARTDAY]</b> until the operations are completed. We apologize for any inconvenience caused during this time.";

                            warningStr = warningStr.replace("[STARTHOUR]", moment(ret.ReleaseStartDate).format("HH:mm"));
                            warningStr = warningStr.replace("[STARTDAY]", moment(ret.ReleaseStartDate).format(dateformat));

                            $("#mainReleaseBanner").html(warningStr);
                            $("#mainReleaseBanner").show();
                        }
                        else
                            $("#mainReleaseBanner").hide();
                    }
                }
                else
                    $("#mainReleaseBanner").hide();
            }).fail(function (jqXHR, textStatus, errorThrown) {
                $("#mainReleaseBanner").hide();
            });
        }
</script>
</body>
</html>

Image

@rcavaliere
Copy link
Member Author

@Luscha thanks for the bug documentation, this what I thought. Let me check with the tech supplier, I let you know. In the meantime let's put this on hold

@rcavaliere
Copy link
Member Author

@Luscha I have got the following feedback:

Can you try and give me a feedback?

@Luscha
Copy link

Luscha commented Feb 20, 2025

@rcavaliere with the new oauth endpoint i'm able to retrieve the data

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