• B
    Balistar

    Congratulations.

    I see references to 4.0, any info on that?

    posted in Announcements read more
  • B
    Balistar

    Thanks Fox.
    Using normal HTTP Retriever the "Settable" works. Just not the with the JSON variant.

    But even if there is a fix for the JSON version, I suspect that the HTTP JSON Retriever will, like the normal one, do a SET with a GET method Query. While there is no official method to do a HTTP "set", a POST or PUT would be a lot more appropriate than a GET.

    {"method":"GET","path":"/api","query":{"name":"airtemp","value":"25"},"headers":{"x-forwarded-for":"103.30.92.123","x-forwarded-proto":"http","x-forwarded-port":"80","host":"80a86fbe836e421a7363a19aee8ef3d8.m.pipedream.net","x-amzn-trace-id":"Root=1-5ec232c0-a1ad0510c55a8440ee963140","user-agent":"Apache-HttpClient/4.5.5 (Java/11.0.5-ea)","accept-encoding":"gzip,deflate"}}
    

    I will probably write a script that retrieves and sets points through the devices REST API.

    Your edit relates to HTTP receiver, not the retriever.

    posted in How-To read more
  • B
    Balistar

    I have define a HTTP JSON Retriever Source and added a Set Point URL. This saves OK.

    0_1589779390993_fef686c6-85d0-45bd-b9b5-28b56092a515-image.png

    Data point definition saves and validates fine.
    However, The when the "Settable" box and Set Point Name are configured saving the point returns an error.

    0_1589779718614_57f6b84e-3e37-4858-8ee1-b3fd7d982843-image.png

    Internal Server Error — java.lang.ClassCastException: class com.serotonin.m2m2.http.vo.HttpJsonRetrieverDataSourceVO cannot be cast to class com.serotonin.m2m2.http.vo.HttpRetrieverDataSourceVO (com.serotonin.m2m2.http.vo.HttpJsonRetrieverDataSourceVO and com.serotonin.m2m2.http.vo.HttpRetrieverDataSourceVO are in unnamed module of loader java.net.URLClassLoader @560513ce)
    

    Any advice? Documentation is a little thin on this/

    Version 3.7.1

    A previous similar question was not really answered:
    Re: How to set a value using http

    posted in How-To read more
  • B
    Balistar

    No need for MangoUI other than now and then do Admin stuff, We use our own Dashboards.

    0_1581995259249_Image 130.jpg

    The API will be used in device on-boarding. Admin creates User, JWT, DataSource (device). Sets new user role to DataSource. This info will be set in device, which creates its own DataPoints (15 to 50) and uploads measuring data to the system from then on.

    The JWT is not ideal from a security stand point, but good enough got us at the moment.

    0_1581995701589_Image 131.jpg

    posted in User help read more
  • B
    Balistar

    Thanks. My goal is to keep the API request JSON as small as possible, so I omitted as much as possible to the POST request to create a DP. Too much.

    You are right.

      "readPermission":"emon3175585",
      "setPermission":"emon3175585",
    

    needed to be added.

    {
      "name": "test12-test2",
      "xid": "test12-test2",
      "dataSourceXid" : "test12",
      "readPermission":"emon3175585",
      "setPermission":"emon3175585",
      "pointLocator" : {
           "startValue" : "0",
           "modelType" : "PL.VIRTUAL",
           "dataType" : "NUMERIC",
           "settable" : true,
           "changeType" : "NO_CHANGE",
           "max": 100,
           "maxChange": 0.01,
           "min": 0
        }
    }
    

    My concern is the API, so that is solved.

    The GUI DP creation permission may still have a problem as there is no SAVE button.

    posted in User help read more
  • B
    Balistar

    There is no console error because there is no SAVE button to press.

    Using the API with JWT issued to user emon3175585:

    curl --location --request POST 'http://xx.xx.xx.xx:8080/rest/v2/data-points' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer eyJhbGciOiJFUzUxMiJ9.eyJzdWIiOiJlbW9uMzE3NTU4NSIsImV4cCI6MTU4MTk5NjgxMywiaWQiOjQsInYiOjEsInR5cCI6ImF1dGgifQ.AClqeOT6yAQCjGMYfXaMlDVgAcVOftGy3TSCrjxWat-Iz2yFut5nP4wntnE1xas3VtieFbxVwffbhmXwngPhHi8VAEFPPoaCD11unJ5_VTVWJkwnx73Eq8L2sbI9abLVM_CXXXXXXXXXXXXXX' \
    --data-raw '{
      "name": "test12-test2",
      "xid": "test12-test2",
      "dataSourceXid" : "test12",
      "pointLocator" : {
           "startValue" : "0",
           "modelType" : "PL.VIRTUAL",
           "dataType" : "NUMERIC",
           "settable" : true,
           "changeType" : "NO_CHANGE",
           "max": 100,
           "maxChange": 0.01,
           "min": 0
        }
    }'
    

    Results in error: 422 Unprocessable Entity

    {
      "result": {
        "messages": [
          {
            "level": "ERROR",
            "message": "Must retain permission",
            "property": "readPermission"
          },
          {
            "level": "ERROR",
            "message": "Must retain permission",
            "property": "setPermission"
          }
        ]
      },
      "mangoStatusCode": 4002,
      "mangoStatusName": "VALIDATION_FAILED",
      "localizedMessage": "Validation failed"
    }
    

    posted in User help read more
  • B
    Balistar

    Naturally. But that was set already:

    0_1581992332387_Image 129.jpg

    posted in User help read more
  • B
    Balistar

    Thanks for your fast response.

    I am probably missing something.

    New DataSource created by Admin. User (emon3175585) given permission to edit the DataSource.

    0_1581985065225_Image 127.jpg

    Yet, when user (emon3175585) logs in, the user cannot create new DataPoint.

    0_1581985190960_Image 128.jpg

    posted in User help read more
  • B
    Balistar

    Fox. Running Core 3.7.3.

    Admin creates new USER. Admin creates DataSource and gives READ and WRITE access to new user ONLY for that DataPoint.

    New USER can EDIT DataSource, but cannot create DataPoints .Both through GUI and API with JWT.

    Once Admin Creates a new DataPoint for that DataSource new user can edit that DataPoint.

    The intent of Permission to a DataSource works correctly after Admin has created one and assigned read/write permissions for that DataSource to a User, that User has edit/set ability to all DataPoints of that DataSource without that user having explicit read/write permission to those DataPoints. I guess permission inheritance works for this.

    posted in User help read more
  • B
    Balistar

    A attempt will be awarded a 422 http code. "Must retain permission". Not a 401 "Not Authorized". So perhaps I am missing something.

    I am not sure if this makes sense. If the admin chooses to give a user edit access to a DataSource, it seems logical that that user should also be able to create DataPoints. If the admin is concerned with DataSource security, the admin should not give the user edit permission to the DataSource, but only to DataPoints.

    posted in User help read more