• 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

    How do I create a datasource using the Mango API?

    User help
    2
    5
    2.6k
    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.
    • G
      gary
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • phildunlapP
        phildunlap
        last edited by

        Hi Gary,

        I think the problem you're experiencing is probably that there was a bug preventing the HTTP Receiver from being created or saved through the API. I fixed this and released a new version of the module, 1.6.2.

        If you've got that version, the easiest / best way to get the JSON model is by doing a GET for a data source you've made through the UI. But, here's the JSON for a an HTTP Receiver from my testing:

        {
          "xid": "httpReceiver2",
          "name": "HTTP Receiver",
          "enabled": false,
          "modelType": "HTTP_RECEIVER",
          "validationMessages": [],
          "deviceIdWhiteList": [
            "*"
          ],
          "setPointUrl": "",
          "ipWhiteList": [
            "*.*.*.*"
          ],
          "editPermission": "",
          "purgeSettings": {
            "override": false,
            "frequency": {
              "periods": 1,
              "type": "YEARS"
            }
          },
          "alarmLevels": {
            "SET_POINT_FAILURE": "URGENT"
          }
        }
        

        One must use the POST /rest/v1/data-sources to create data sources, and the PUT /rest/v1/data-sources/[XID] to update existing data sources.

        Thanks for bringing that bug to our attention!

        G 1 Reply Last reply Reply Quote 1
        • G
          gary @phildunlap
          last edited by

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

          1 Reply Last reply Reply Quote 0
          • G
            gary
            last edited by

            It works :)

            1 Reply Last reply Reply Quote 0
            • phildunlapP
              phildunlap
              last edited by

              Glad to hear it!

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