cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Retriving the list of DataItems for a specific Asset

SOLVED
Newbie

Retriving the list of DataItems for a specific Asset

Hi,

 

How can I retrive the list of dataItems for a specific asset using the API?

The <server>/services/v2/rest/dataItem/find only support modelNumber, name and type as criteria.

If there are many assets that are using the same model the query will return all the dataItems from all assets using the model.

 

Thank you,

Catalin Costea

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Retriving the list of DataItems for a specific Asset

In my example, the asset I have has 5 "current" data items in the asset dashboard, and the model has 12 configured data items.  Though my request returns *ALL* model data items, only the "current" data items will have a <v2:value> element in the response data.

POST: https://INSTANCE/services/v2/rest/dataItem/findCurrentValues

with Query Body:

<CurrentDataItemValueCriteria xmlns="http://www.axeda.com/services/v2">

<assetId>24337</assetId>

</CurrentDataItemValueCriteria>

Response:

<Response xmlns="https://INSTANCE/services/v2/rest/dataItem/findCurrentValues">

   <criteria>

     ....

   </criteria>

   <dataItemValues>

      <e>

         <asset/>

         <dataItem/>

         <value>100</value>  

      </e>

   </dataItemValues>


This API is behaving as expected, and only populated data is being presented to you with your request.

Value will be null/not-present for any data item that isn't valid on that Asset, but that is present on the Model.

15 REPLIES 15
Highlighted

Re: Retriving the list of DataItems for a specific Asset

Hi Catalin

Please note that data items are model based and that all assets share the list of data items from the model they belong to.

Now based on the asset, those data items will change based on thresholds and other changes.

You could query each asset for their specific data item values both current or historical.

Re: Retriving the list of DataItems for a specific Asset

I know I can query each asset for their data item values. I am looking for the list of the dataItems for a specific device/asset. Is there a way to get this?

Re: Retriving the list of DataItems for a specific Asset

Assuming you have the systemId of the asset, might not the following meet your needs?

POST: /services/v2/rest/dataItem/findCurrentValues

<CurrentDataItemValueCriteria xmlns="http://www.axeda.com/services/v2">

   <assetId>24337</assetId>

</CurrentDataItemValueCriteria>

Re: Retriving the list of DataItems for a specific Asset

Theoretically yes, it will be a good workaround and I can parse the items list from the response.

Unfortunately is returning the list of all dataItems associated with the model that is mapped with the assetId.

Any other suggestions are welcome.

Thank you.

Re: Retriving the list of DataItems for a specific Asset

The following seemed to work for me:

POST: /services/v2/rest/dataItem/findHistoricalValues

Depending on how tight your time window is will determine how many data items get returned. Each dataitem could return multiple values of itself depending on retention history and activity.

In my case the Dashboard shows 5 data items for this asset, and this query returns 5 data items.

Re: Retriving the list of DataItems for a specific Asset

This is working in a way, it is true this only returns dataItemsValues for the current Asset but the dataItems are repeating and since I have many values in response ("totalCount" : 63010 until now) it will be kinda awkward parse it all to create a set of 5 unique dataItems ...

The solution with /services/v2/rest/dataItem/findCurrentValues was perfect if it was working.

Re: Retriving the list of DataItems for a specific Asset

Current values is the way to go.  If an asset has a data item, the most recent value will appear in the current table.  With historical, it had to have been received within the date range.  And the query will probably be less efficient since the table can be much larger.

Re: Retriving the list of DataItems for a specific Asset

Current values is returning the list of all dataItems associated with the model that is mapped with the assetId ...

Re: Retriving the list of DataItems for a specific Asset

Ignore the ones with null value?