SystemLink Forum

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to create custom Assets using Asset API.

Solved!
Go to solution

Background: I'm trying to do some Asset Management where I have SystemLink detect whether a device is "connected" to the client machine or not. I have custom logic to determine if the device is connected or not, but I'm unable to make this Asset show up on the SystemLink web app.

 

Using this API, but for some reason the Salt Minion won't pick up my .json file. The asset file content is shown below.

 

{
    "assets": [
        {
            "assetName": "Test device",
            "serialNumber": 123123,
            "modelName": "Device Model 1",
            "vendorName": "Acme",
        }
    ]
}

  

Not sure if the API is relevant or not anymore, any help would be appreciated.

0 Kudos
Message 1 of 6
(1,393 Views)
Solution
Accepted by topic author Mason.Chou

Your JSON is invalid because it has a trailing comma after "Acme" and the serialNumber has to be a string instead of an int.

0 Kudos
Message 2 of 6
(1,367 Views)

Thanks, that seems to do the trick.

 

I'm also having a hard time understanding how the SystemLink determines if a custom asset is "in use" or "disconnected". So far it seems like deleting the json file will get the minion to disconnect the asset, but modifications of the json file won't. I'm also not really sure how to tell SystemLink that the device is still connected, but isn't in use.

 

Are we suppose to be making an json file for each asset? Is there any documentation on these behaviors?

0 Kudos
Message 3 of 6
(1,340 Views)

There is a Windows tray application that out of the box will mark every asset in the system as in use the moment a user logs into the system either locally or over remote desktop with the utilization type set to Configuration. You can modify the SL tray application to not automatically mark all of the assets in use and instead use the LV, .NET, Python or HTTP to programmatically set when and which assets are in use.

0 Kudos
Message 4 of 6
(1,314 Views)

Thanks, can you send a link to the .NET or HTTP API on how to programmatically setting it? 

 

Using the System Tray is a bit buggy and I'm getting scenarios like this (Note one of my device is disconnected, but it's in use?). 

 

MasonChou_0-1654638620948.png

 

 

0 Kudos
Message 5 of 6
(1,299 Views)

Here is a link to the .NET API documentation.

https://www.ni.com/docs/en-US/bundle/systemlink-2021-r3-api-overview/page/net-api-reference.html

 

 

To view the HTTP documentation for any of the APIs just click on the ? in the top right-hand corner of any SL web interface and then select "HTTP API" to open up the Swagger documentation. You switch between different APIs by using the drop-down on the top right.

 

https://www.ni.com/docs/en-US/bundle/systemlink-2021-r3-api-overview/page/http-api-reference.html

 

Screen Shot 2022-06-08 at 12.35.37 PM.png

 

0 Kudos
Message 6 of 6
(1,293 Views)