• S
    silvia

    Hi all,

    I'm also interested in the MQTT publisher.
    Is there a planned release date or any updates?

    Thanks :)

    posted in Wishlist read more
  • S
    silvia

    You're both absolutely right, maybe I wasn't refreshing the page to see the newly created events, I can now... Thanks so much for all of your help! :)

    posted in User help read more
  • S
    silvia

    @Jared-Wiltshire, @phildunlap, thanks for your answers. Because I'm trying to create 5 events for each data point, it'd rather do it in bulk importing the JSON.

    I can easily import using the 'Import' tab.

    0_1510737986128_mango.JPG

    However, if I try to do the same through the API (either using POST /v1/json-emport or /v1/json-emport/upload-file), I get error 202 - no content.

    0_1510738898742_mango2.JPG

    These are the response headers:

    {
      "Location": "http://192.168.100.254:8080/rest/v1/json-emport/import/IMPORT_e85e1010-ed81-46c3-bc02-2a24637e1065",
      "Date": "Wed, 15 Nov 2017 09:33:46 GMT",
      "Cache-Control": "no-cache, no-store, max-age=0, must-revalidate",
      "X-Content-Type-Options": "nosniff",
      "X-Frame-Options": "SAMEORIGIN",
      "Content-Length": "0",
      "X-Xss-Protection": "1; mode=block"
    }
    

    I've also tried removing the outer object and the "dataPoints" array, so that the body only contains the data point object. Regarding the timezone, I'm setting it to either blank, '+00:00' or 'Europe/London', as another post suggested checking here for valid timezones: http://joda-time.sourceforge.net/timezones.html.

    Any new ideas please? Thanks :)

    posted in User help read more
  • S
    silvia

    Re: How do I create event detectors using the Mango API?

    Hi all,

    I see that event-detectors is now part of the API :)

    I'm trying to create multiple event detectors for the same multi-state data point; is that possible to do in one single step?

    At the moment I'm trying to do a single event detector using the POST method through the API and using this code (obtained via GET for another data point, and changing the xid, dataSourceId and dataPointId) -- it doesn't work, though, and I get an error 500 back.

        {
              "xid":          "socket_2026-vacant",
              "name":         "Socket 2026 is vacant",
              "duration":       0,
              "durationType":     "SECONDS",
              "alarmLevel":       "INFORMATION",
              "supportedDataTypes": [
                  "MULTISTATE"
              ],
    
              "description":      "Socket 2026 is vacant",
              "alias":            "Socket 2026 is vacant",
              "eventType": {
                "dataSourceId":     229,
                "dataPointId":      400,
                "duplicateHandling":  "IGNORE",
                "typeName":        "DATA_POINT",
                "rateLimited":      false
              },
    
              "rtnApplicable":        true,
              "detectorSourceType":   "DATA_POINT",
              "validationMessages":   [],
              "detectorType":         "MULTISTATE_STATE"              
            }
    

    I want these event detectors to be created immediately after the data points are created, so I'm using response.data.id and response.data.dataSourceId to get this info.

    I would think that these two ids are enough to link the event detector with the data point? What am I doing wrong here? And can I create multiple event detectors at once?

    Thanks and sorry for so many questions ^^U

    Silvia

    posted in User help read more
  • S
    silvia

    It goes perfectly, thanks again!

    posted in User help read more
  • S
    silvia

    Thanks guys, I'll try it out today or next week and see how it goes! :)

    posted in User help read more
  • S
    silvia

    Hi all,

    I can successfully create Watch Lists through the Mango REST API using Node.js and Javascript, but how can I assign data points to them?

    I have tried retrieving an existing watchlist through GET /v1/watch-lists, but it doesn't have any information about the data points in it. I can get all the data points throught GET /v1/watch-lists/{xid}/data-points, but I still don't get how to create a watchlist and associate data points to it.

    Any ideas? Is it a two-step process (creating the watchlist first with POST and updating it later with PUT?)?

    Thanks in advance.

    posted in User help read more
  • S
    silvia

    Wonderful!!!

    It works perfectly :D

    Thanks @phildunlap

    posted in User help read more
  • S
    silvia

    Hi again,

    Node-mango-client works like a charm for creating the data sources, thanks! :)

    However, when I'm trying to create a data point, I start by copying the model schema from POST /v1/data-points and defining a couple of parameters.

    {
      "enabled": true,
      "templateXid": "readings",
      "loggingProperties": {
        "tolerance": 0,
        "discardExtremeValues": false,
        "discardLowLimit": 0,
        "discardHighLimit": 0,
        "loggingType": "ALL",
        "intervalLoggingType": "MINUTES",
        "intervalLoggingPeriod": {
          "periods": 1,
          "type": "MINUTES"
        },
        "overrideIntervalLoggingSamples": false,
        "intervalLoggingSampleWindowSize": 0,
        "cacheSize": 0
      },
      "textRenderer": {
        "settable": false,
        "relinquishable": false
      },
      "chartRenderer": {
        "settable": false,
        "relinquishable": false
      },
      "modelType": "",
      "validationMessages": [
        {
          "message": "",
          "level": "",
          "property": ""
        }
      ],
      "id": 0,
      "dataSourceId": 0,
      "readPermission": "",
      "setPermission": "",
      "chartColour": "",
      "rollup": "NONE",
      "plotType": "LINE",
      "purgeOverride": false,
      "purgePeriod": {
        "periods": 1,
        "type": "YEARS"
      },
      "pointLocator": {
        "settable": false,
        "relinquishable": false
      },
      "deviceName": "socket 1743",
      "dataSourceXid": "SK1743",
      "useIntegralUnit": false,
      "useRenderedUnit": true,
      "unit": "kW",
      "renderedUnit": "kW",
      "integralUnit": "",
      "dataSourceName": "socket_1743",
      "name": "reading",
      "xid": "sk1743_r"
    }
    

    To make it easy, I copy this into the 'body' and I use the 'Try it Out' button, but it returns an error 400.

    Response Code

    400
    

    Response Body

    {
      "message": null,
      "stackTrace": "com.serotonin.m2m2.web.mvc.rest.v1.mapping.SuperclassModelDeserializer.deserialize(SuperclassModelDeserializer.java:49)\ncom.serotonin.m2m2.web.mvc.rest.v1.mapping.SuperclassModelDeserializer.deserialize(SuperclassModelDeserializer.java:25)\ncom.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:499)\ncom.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:101)\ncom.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:357)\ncom.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:148)\ncom.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3798)\ncom.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2922)\norg.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:237)\norg.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.read(AbstractJackson2HttpMessageConverter.java:225)\norg.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:201)\norg.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:150)\norg.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:128)\norg.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:121)\norg.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:158)\norg.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:128)\norg.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)\norg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)\norg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)\norg.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)\norg.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)\norg.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)\norg.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)\norg.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)\njavax.servlet.http.HttpServlet.service(HttpServlet.java:707)\norg.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)\njavax.servlet.http.HttpServlet.service(HttpServlet.java:790)\norg.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:845)\norg.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1689)\norg.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)\norg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\norg.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676)\norg.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:110)\ncom.serotonin.m2m2.web.filter.MangoShallowEtagHeaderFilter.doFilterInternal(MangoShallowEtagHeaderFilter.java:80)\norg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\norg.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)\norg.springframework.security.web.authentication.switchuser.SwitchUserFilter.doFilter(SwitchUserFilter.java:198)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)\norg.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\ncom.serotonin.m2m2.web.mvc.spring.security.PermissionExceptionFilter.doFilter(PermissionExceptionFilter.java:32)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:134)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:121)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:124)\norg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)\norg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)\norg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\norg.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)\norg.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)\norg.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)\norg.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)\norg.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)\norg.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)\norg.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)\norg.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\norg.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)\norg.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)\norg.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)\norg.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)\norg.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)\norg.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)\norg.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\norg.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)\norg.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:397)\norg.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)\norg.eclipse.jetty.server.Server.handle(Server.java:524)\norg.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319)\norg.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253)\norg.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)\norg.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)\norg.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)\norg.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)\norg.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)\norg.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)\norg.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)\norg.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)\njava.lang.Thread.run(Thread.java:748)\n"
    }
    

    Response Headers

    {
      "Date": "Wed, 08 Nov 2017 15:58:26 GMT",
      "X-Content-Type-Options": "nosniff",
      "X-Frame-Options": "SAMEORIGIN",
      "Content-Type": "application/json;charset=utf-8",
      "Cache-Control": "no-cache, no-store, max-age=0, must-revalidate",
      "Messages": "error",
      "Content-Length": "10009",
      "X-Xss-Protection": "1; mode=block"
    }
    

    The model from the REST API also makes me wonder how to define the data type in the pointLocator object, and the type and units in textRenderer. Also, in the case of multistate points, how to define the multistateValues and event detectors?

    I thought it would be as simple as copying the export JSON from the data point...

    Thanks again for your time.

    posted in User help read more
  • S
    silvia

    Thanks @phildunlap and @Jared-Wiltshire :)

    I'm using node.js so I will give node-mango-client a go and see how it goes!

    Cheers,

    Silvia

    posted in User help read more