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

Minimum required Mango REST V2 API JSON values documentation


  • To start with there is nothing at http://MANGO-IP:8080/rest/v2/swagger/v2/api-docs

    Nor can I find any detailed information.

    Specifically I would like to know the required minimum json values for

    PUT /rest/v2/data-points (create data-point)

    The example in Swagger lists all values, but there is no indication which values are required and which values are set to default when left out. The full PUT request to create a point is (relatively) large 1634 bytes for the request data below.

    Also, I am looking for a list of error codes for each API.

    {
      "xid": "Dummy12345-1",
      "name": "Dummy12345-1",
      "enabled": true,
      "deviceName": "dummy12345",
      "readPermission": "",
      "setPermission": "",
      "pointFolderId": 0,
      "purgeOverride": false,
      "pointLocator": {
        "max": 100,
        "min": 0,
        "maxChange": 0.1,
        "startValue": "50",
        "modelType": "PL.VIRTUAL",
        "dataType": "NUMERIC",
        "settable": true,
        "changeType": "BROWNIAN",
        "values": []
      },
      "chartColour": "",
      "loggingProperties": {
        "cacheSize": 1,
        "loggingType": "INTERVAL",
        "tolerance": 0,
        "discardExtremeValues": false,
        "intervalLoggingType": "AVERAGE",
        "intervalLoggingPeriod": {
          "periods": 1,
          "type": "MINUTES"
        },
        "overrideIntervalLoggingSamples": false
      },
      "textRenderer": {
        "type": "textRendererAnalog",
        "format": "0.00",
        "suffix": "",
        "useUnitAsSuffix": false
      },
      "chartRenderer": {
        "type": "chartRendererImage",
        "timePeriod": {
          "periods": 1,
          "type": "DAYS"
        }
      },
      "rollup": "NONE",
      "simplifyType": "NONE",
      "simplifyTolerance": "NaN",
      "simplifyTarget": 1000,
      "templateXid": null,
      "dataSourceXid": "dummy12345",
      "tags": {},
      "plotType": "SPLINE",
      "dataSourceTypeName": "VIRTUAL"
    }
    

  • @Balistar there are many permutations of creating a data point but this should give you a decent start:

    https://github.com/infiniteautomation/ma-modules-public/blob/85658f8eed2e681c00c0511c9264c4901be87670/Mango API/api-test/dataPoint.spec.js#L167

    specifically:

    {
      name: 'Node mango client test 2',
      dataSourceXid : 'mango_client_test',
      pointLocator : {
           startValue : '0',
           modelType : 'PL.VIRTUAL',
           dataType : 'NUMERIC',
           settable : false,
           changeType : 'BROWNIAN',
           max: 100,
           maxChange: 0.01,
           min: 0
        }
    }
    

    As for error code documentation, our Swagger documentation isn't complete so that will have to be trial and error, Generally these are the only errors you will get from our controllers:

    500 - Server error
    422 - Validation error
    404 - item not found
    400 - Bad Request


  • Thanks Terry,

    Almost. Mango API needs double quotes around names and values. Anyway this works:

    {
      "name": "emon3175585-19",
      "xid": "emon3175585-19", <-- no need if you want Mango to auto create
      "dataSourceXid" : "emon3175585",
      "enabled": true,
      "pointLocator" : {
           "startValue" : "0",
           "modelType" : "PL.VIRTUAL",
           "dataType" : "NUMERIC",
           "settable" : true,
           "changeType" : "NO_CHANGE"
        }
    }
    

    To add a few more codes:
    201 - Created
    403 - no authorization


  • No worries,

    Sorry about that you are right, that was a node.js code snippet not JSON. And yes those codes are also very common. In v3 of the REST api we are going to put some effort into making the Swagger output accurate AND useful...