• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Adding/updating points via the REST API.

    Dashboard Designer & Custom AngularJS Pages
    2
    7
    3.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Igor ZhalkinI
      Igor Zhalkin
      last edited by Igor Zhalkin

      We're trying to use the API to add and update points, but it doesn't seem to work.

      When I try using "put /v1/data-points/{xid}:Update an existing data point", I get a 406 response.

      {
      "Date": "Wed, 09 Dec 2015 07:23:42 GMT",
      "Errors": "Validation error",
      "Content-Type": "application/json; charset=UTF-8",
      "Transfer-Encoding": "chunked",
      "Server": "Jetty(9.2.12.v20150709)"
      }

      When I try to use the bulk update, I get response 200, but there is no change to the actual points.

      {
      "Date": "Wed, 09 Dec 2015 07:31:39 GMT",
      "Content-Type": "application/json; charset=UTF-8",
      "Transfer-Encoding": "chunked",
      "Server": "Jetty(9.2.12.v20150709)"
      }

      Someone was able to make it work?

      1 Reply Last reply Reply Quote 0
      • terrypackerT
        terrypacker
        last edited by terrypacker

        It looks like your JSON data isn't validating properly. The response from Mango will contain a list of validation messages that will tell you what is wrong. The messages are in JSON and are the body of the response.

        To get started I would suggest performing a GET and then a PUT with exactly the same JSON as received in the GET.

        Igor ZhalkinI 1 Reply Last reply Reply Quote 0
        • Igor ZhalkinI
          Igor Zhalkin @terrypacker
          last edited by

          @terrypacker

          That's exactly what I tried, and I still get 406 response. Here is the body I get:

          {
          "enabled": true,
          "templateXid": "Binary_Default",
          "loggingProperties": {
          "tolerance": 0,
          "discardExtremeValues": false,
          "discardLowLimit": -1.7976931348623157e+308,
          "discardHighLimit": 1.7976931348623157e+308,
          "loggingType": "ON_CHANGE",
          "intervalLoggingType": "INSTANT",
          "intervalLoggingPeriod": {
          "periods": 15,
          "type": "MINUTES"
          },
          "overrideIntervalLoggingSamples": false,
          "intervalLoggingSampleWindowSize": 0,
          "cacheSize": 1
          },
          "textRenderer": {
          "zeroLabel": "zero",
          "zeroColour": "blue",
          "oneLabel": "one",
          "oneColour": "black",
          "type": "textRendererBinary"
          },
          "chartRenderer": {
          "limit": 10,
          "type": "chartRendererTable"
          },
          "modelType": "DATA_POINT",
          "validationMessages": [
          {
          "message": "Required value",
          "level": "ERROR",
          "property": "alternateBooleanChange.startValue"
          }
          ],
          "dataSourceId": 0,
          "deviceName": "A",
          "chartColour": "blue",
          "plotType": "STEP",
          "purgeOverride": false,
          "purgePeriod": {
          "periods": 1,
          "type": "YEARS"
          },
          "pointLocator": {
          "dataType": "BINARY",
          "settable": false,
          "changeType": "ALTERNATE_BOOLEAN",
          "modelType": "PL.VIRTUAL",
          "relinquishable": false
          },
          "readPermission": "superadmin",
          "setPermission": "superadmin",
          "dataSourceXid": "teat 2-DS",
          "pointFolderId": 0,
          "unit": "",
          "useIntegralUnit": false,
          "integralUnit": "s",
          "useRenderedUnit": false,
          "renderedUnit": "",
          "dataSourceName": null,
          "id": 18,
          "xid": "DP_519610",
          "name": "A"
          }

          The only difference from the get is the dataSourceId and Name that became 0 and null respectively. Any advice?

          1 Reply Last reply Reply Quote 0
          • terrypackerT
            terrypacker
            last edited by

            It looks like you found a bug in the Virtual Data Source data point model. You can see from the validation messages:

            "validationMessages": [
              {
                "message": "Required value",
                "level": "ERROR",
                 "property": "alternateBooleanChange.startValue"
              }
            ],
            

            But there is no member in the point locator for this in the model. I've just checked the code and can see the problem. I'll put together a fix for this. In the meantime try another data source type instead of Virtual.

            1 Reply Last reply Reply Quote 0
            • terrypackerT
              terrypacker
              last edited by

              On further investigation it doesn't look like any data points can be updated this way yet. The REST api for saving data points and data sources isn't fully implemented yet as we are still using the legacy way of modifying them in the UI.

              For starters the Event Detectors cannot be modified via the DataPointModel so you won't be able to fully update a data point and most likely will get a 500 response when Mango tries to save it.

              1 Reply Last reply Reply Quote 0
              • terrypackerT
                terrypacker
                last edited by

                We are currently using the REST api to modify data points using the text/csv content type. This is limited though as only some of the fields are available while the remainder are applied via the templateXid.

                Igor ZhalkinI 1 Reply Last reply Reply Quote 0
                • Igor ZhalkinI
                  Igor Zhalkin @terrypacker
                  last edited by

                  @terrypacker I was able to update/create points for a BACnet device using the JSON format. So it seems that it works, at least partially.

                  Thanks for your help.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post