• G
    gary

    Thank you, @Jared-Wiltshire. That's excellent, I shall give that a go.

    posted in User help read more
  • G
    gary

    Hi,

    I have previous experience using AngularJS and would like some of my work to be reused. How can I register an AngularJS directive for use in a custom dashboard?

    Regards,

    Gary

    posted in User help read more
  • G
    gary

    @hrivers In my experience with the Mango API, sometimes you need to include the header 'x-xsrf-token' as well as the cookies.

    Try this modification:

    $headers = array(
    'Accept: application/json',
    'Content-Type: application/json', //multipart/form-data
    'Connection: keep-alive',
    'Cache-Control: no-cache',
    'Cookie: XSRF-TOKEN='.$xsrf_token.';MANGO8080='.$mango8080,
    'x-xsrf-token: ' . $xsrf_token             //ADDED
    );
    
    

    Gary

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • G
    gary

    It sounds like this is not really a Mango related question but a web development related one.

    You probably want to use localStorage. Alternatively you could use cookies but I think you're most likely to want to use localStorage. Cookies are sent to the server with every HTTP request, which would be pointless in the case of a Mango dashboard.

    These APIs allow you to store data on the client machine for use at a later time. They have limitations and risks. The user can remove this data and it can expire when the user closes their browser or after a predefined period of time. You shouldn't store anything sensitive on the client side and when retrieving data, it should be treated with the same caution as any other input because it is easy for a malicious user to manipulate.

    Gary

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • G
    gary

    Ok, thanks Joel. That's great to know. It sounds like v3 will be a big advance forward for Mango.

    posted in User help read more
  • G
    gary

    Hi,

    I am creating a system that allows the dynamic addition of monitored devices. Through the Mango API I have successfully created data sources and data points. Some of the points created should have event detectors. All event detectors are state detectors in my system.

    There doesn't seem to be any end points listed in the Swagger documentation for creating event detectors. So, how do I create event detectors using the Mango API?

    Regards,

    Gary

    posted in User help read more
  • G
    gary

    @phildunlap Thank you. I will give it a try.

    posted in User help read more
  • G
    gary

    Hi,

    Swagger shows some details of two API end points that potentially could be used. I'm not sure if I need to PUT to /rest/v1/data-sources/{XID} or POST to /rest/v1/data-sources . I have spent most time trying the PUT option as it is conceptually more appropriate but I get the same result either way.

    My attempts have been met with 500 Server Error because I have not uploaded a correctly specified JSON object. I need an explanation of the JSON schema to upload. I tried to create a copy of an existing datasource by uploading the exported JSON for the original with a modified parameter values. The format is not the same as the Swagger documentation specifies so I wasn't surprised I didn't get it to work.

    The swagger documentation doesn't make it obvious how to specify that it is a HTTP listener that I wish to create. There are parameters specific to this type that I want to set including IP white list and device ID white list.

    Can anyone fill in the gaps please?

    Thanks,

    Gary

    posted in User help read more
  • G
    gary

    Hi,

    To add to what phildunlap said, you must include 'application/json' in the accepts header.

    If basing your code on the question and answers on that stackoverflow page, you would need to add the following line before invoking the send method:

    objHTTP.setRequestHeader "accept", "application/json"

    Regards,

    Gary

    posted in How-To read more
  • G
    gary

    @phildunlap Very useful information. I searched and found exactly what I needed to know in this answer. Thanks.

    posted in User help read more
  • G
    gary

    I have spent an embarrassingly long time tearing my hair out due to a problem that happens with the Safari browser both on MacOS and iOS. This problem does not affect Chrome, Firefox or IE. I hope this post helps someone else.

    Our use case is a bespoke web based front end using the Mango API. We will use the Mango web interface for administration and expect our users to use the bespoke front end only.

    If hosting a web site on a different domain to Mango, Safari users will have to change their settings or any attempt to use the realtime Mango API will result in 'NOT LOGGED IN' error messages. This is caused because Safaris default configuration will prevent it from sending the authentication cookie when initiating the web socket connection.

    The setting in question is 'Cookies and website data'. It must be set to 'always allow'.

    Screen Shot 2015-09-23 at 15.48.11.png

    Using the same domain but different ports (enough to require CORS headers be configured for AJAX requests) will NOT cause this problem.

    I believe that anyone trying to keep web server and Mango as separate concerns will have to experiment with subdomains.

    Gary Ott
    DVR Ltd

    posted in User help read more
  • G
    gary

    Hi Joel,

    I am looking forward to getting my hands on it. Keep up the great work.

    Is there an estimated release date yet?

    Regards,

    Gary Ott
    DVR Ltd

    posted in Announcements read more
  • G
    gary

    Hi,

    How do I configure HTTP headers sent in responses from Mango?

    I need to set Access-Control-Allow-Origin because I need to be able to host Mango on a different server to one hosting a web site utilising the Mango API.

    This HTTP header is used to allow AJAX requests where the referring page is not located on the same server.

    I have worked around this problem when using JSP by setting a HTTP header from code.

    Gary

    posted in User help read more
  • G
    gary

    Hi,

    I can register to receive events on multiple points through the web sockets API but it doesn’t tell me which point changed when I receive messages back.

    Is there any possibility of adding the XID on the payload object?

    It looks like this was always intended but overlooked.

    Gary

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • G
    gary

    Hi everyone,

    We have developed an Excel spreadsheet for delivering test data to HTTP listeners. Find it at https://github.com/DVR-Ltd/sender.

    I hope that others find this useful.

    Gary Ott,
    Software Developer at DVR Ltd

    posted in Mango Automation general Discussion read more
  • G
    gary

    Hi,

    I need to discard extreme values on a meta data point but the user interface found under 'Logging properties' that I have seen in video tutorials is not present. Using the SQL editor, I can see the fields that need changing but I would rather steer clear of delving into the database directly as I am a noob to Mango and don't want to do anything stupid. Please can someone advice me what I need to do to be able to configure extreme value discarding. If the answer is RTFM, please can someone point me to the right place as I simply haven't found it.

    More details: I have a series of meta data points which measure time periods. For the sake of an example, let us say I have called such a point TIME. Each of these has two corresponding boolean* data points. One represents the point to begin the stop watch and the other represents the point to stop the stop watch. I'll call them START and END. I require only one data point from TIME for each START-to-on and END-to-on pair. This means I get unnecessary TIME values when START turns on, START turns off and END turns off. In all of these cases TIME returns undefined (I also tried null and NaN) which gets stored as a zero.

    *I'm actually using multistate types and returning 1 or 0 as this was a work around to an unrelated problem.

    Any help greatly appreciated.

    Regards,

    Gary

    posted in Mango Automation general Discussion read more
  • G
    gary

    Terry,

    I have replicated the 401 error and found the cause. When this error occured, the response headers contain the field 'errors' with a value 'User not logged in'. After a little bit of experimenting, I have worked out what I did to cause this.

    To replicate:

    Using Chrome*, open the Mango web interface and log in.
    Open in another tab of the same window, a web application that utilised the Mango API and log in.
    Separate the two tabs into different browser windows.
    Log out from the web application and you will receive the 401 error.

    *I haven't tried other browsers.

    Explanation:

    The two tabs utilise the same session cookie. The cookie must be associated with one of the two browser windows when the separation occurs. The domain of this cookie matches the domain in the address bar of the mango web interface so the browser understandably associates that cookie with the Mango web interface, not the web application. Now the web application does not have a log-in cookie.

    Possible answers:

    1. Don't do that.
    2. Have the Mango API deliver a different cookie.
    3. Set an expiry time on the cookie.

    For me #2 is preferable but that may not play well with custom dashboards.

    Gary

    posted in User help read more
  • G
    gary

    Unfortunately I am unable to reproduce the problem. I have not modified my code since Friday when I had this issue.

    I have attached a section from ma.log timed just before I posted about the 401 error. I can't see anywhere within this that tells me the HTTP status code returned so I hope it is relevant.

    I came across the 401 when clicking the 'log out' button in my application did nothing. I opened the developer tools in Chrome and immediately saw the error in the console. At the time, I was able to reproduce the error by refreshing the page, logging in and attempting to log out.

    My application uses POST to /rest/v1/login/ and /rest/v1/logout/. The implementation details mirror MangoApi.js which I have been using as a reference implementation.

    Attachment: download link

    posted in User help read more