• 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

    apiv3

    Mango Automation general Discussion
    3
    11
    1.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.
    • Jdiaz-coJ
      Jdiaz-co
      last edited by

      Good morning,

      I would need to know if there is a substitute for the "PUT /point-values" function that allows changing multiple datapoints at once in apiV1 by passing an array as a parameter in apiV3.

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

        @Jdiaz-co I'm a little confused by your phrasing. Maybe use some URLs as examples. But are you asking if there exists a REST v3 endpoint to PUT multiple point's values or if one exists for v1?

        There are POST methods for v3. I can't say for v1 as I don't have the code checked out.

        POST rest/v3/point-values using a JSON model as the body (this is not recommended and deprecated)

        POST rest/v3/point-value-modification/import using a JSON model as the body. (See swagger UI for this)

        1 Reply Last reply Reply Quote 0
        • Jdiaz-coJ
          Jdiaz-co
          last edited by

          Sorry for my English. I'm currently using apiV1, but I'm considering migrating everything to apiV3, which uses Mango v5.0.2. In apiV1, there is a "PUT" function called "/point-values" that allows you to send multiple Datapoints at once. However, I see that this "PUT" in apiV3 either doesn't exist or has changed.

          terrypackerT 1 Reply Last reply Reply Quote 0
          • terrypackerT
            terrypacker @Jdiaz-co
            last edited by

            @Jdiaz-co I just checked and there is still and endpoint available via PUT. If you configure a data point to be 'settable' in the Mango UI and then open Chrome Dev tools while on the Data Point Details page you can set the value and see the PUT request. I can't upload images to the forum due to some problem. But here is the general output from the developer tools view:

            Request URL:  https://localhost:8443/rest/latest/point-values/DP_0f3b0e5d-b9ca-4f2f-916b-f2ddcadbba8a?unitConversion=true
            Request Method: PUT
            Status Code: 201
            
            Payload:
            {
              "value":50,
              "dataType":"NUMERIC",
              "annotation":"Set from web by user: admin"
            }
            
            1 Reply Last reply Reply Quote 0
            • Jdiaz-coJ
              Jdiaz-co
              last edited by

              Indeed, that endpoint works correctly; however, I can only send a single Datapoint in the request. My question is whether there is any endpoint where I can send multiple at once, as was possible in apiV1. I see, since I have tried that same endpoint and haven't been able to achieve it.

              terrypackerT 1 Reply Last reply Reply Quote 0
              • terrypackerT
                terrypacker @Jdiaz-co
                last edited by

                @Jdiaz-co that endpoint only accepts a single point value (as you have discovered). Referring back to my first post I think you are looking for this new v3 endpoint:

                POST rest/v3/point-value-modification/import using a JSON model as the body. (See swagger UI for this)

                I don't think this is exposed in the UI so you will need to use Swagger. However the POST body will need to look like this:

                [
                  {
                    "xid": "MY_POINT_1_XID",
                    "value":  1.0,
                    "timestamp": "ISO Formatted Date String",
                    "annotation": "can be null or any string"
                }, {
                   ....
                ]
                

                The idea being that you supply the xid for the point you want to set the value for.

                1 Reply Last reply Reply Quote 0
                • Jdiaz-coJ
                  Jdiaz-co
                  last edited by

                  @terrypacker said in apiv3:

                  POST rest/v3/point-value-modification/import

                  I've tried the POST "rest/v3/point-value-modification/import" you mentioned from Swagger, and it doesn't work for me when trying to input multiple Datapoints at once. Is there any other way?

                  MattFoxM 1 Reply Last reply Reply Quote 0
                  • MattFoxM
                    MattFox @Jdiaz-co
                    last edited by MattFox

                    @Jdiaz-co
                    I think it is missing

                    "dataType":"NUMERIC"|"ALPHANUMERIC"|"BINARY"
                    

                    You'll need that for each value entry.
                    Pretty sure that's why it's throwing its toys...

                    Fox

                    Do not follow where the path may lead; go instead where there is no path.
                    And leave a trail - Muriel Strode

                    1 Reply Last reply Reply Quote 0
                    • Jdiaz-coJ
                      Jdiaz-co
                      last edited by

                      Hello, in Swagger it works, that is, it gives me a 200 status code, but in Mango the value doesn't change.

                      I'm using this JSON to test it.:

                      [
                      {
                      "xid": "MY_DP",
                      "dataType":"NUMERIC",
                      "timestamp": 184965161,
                      "value": 4
                      }, {
                      "xid": "MY_DP",
                      "dataType":"NUMERIC",
                      "timestamp": 184965161,
                      "value": 2
                      }
                      ]

                      The response is this, however, as I mentioned, the value doesn't change in Mango.

                      [
                      {
                      "xid": "DP_RV-BAR-1CA_bar_cmd",
                      "totalQueued": 1,
                      "totalSkipped": 0,
                      "result": {
                      "messages": [],
                      "valid": true,
                      "hasMessages": false
                      }
                      },
                      {
                      "xid": "DP_RV-BAR-1CA_status",
                      "totalQueued": 1,
                      "totalSkipped": 0,
                      "result": {
                      "messages": [],
                      "valid": true,
                      "hasMessages": false
                      }
                      }
                      ]

                      Thank you for assisting me.

                      MattFoxM 1 Reply Last reply Reply Quote 0
                      • MattFoxM
                        MattFox @Jdiaz-co
                        last edited by MattFox

                        @Jdiaz-co your timestamp needs to be an ISO formatted date-time string, not a unix timestamp!

                        Fox

                        Do not follow where the path may lead; go instead where there is no path.
                        And leave a trail - Muriel Strode

                        1 Reply Last reply Reply Quote 0
                        • Jdiaz-coJ
                          Jdiaz-co
                          last edited by

                          @MattFox thanks for your help, ISO formatted It has worked correctly with the ISO timestamp format.

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