Set and get Asset Type through API
AnsweredIs there currently a way (API V5.0 or 6.0) to get the currently available asset types or set them through the API?
Or do I need to do that through the REST API?
Reason for the question is that I'd like to create new types automatically on the fly if they are not existing yet.
-
Official comment
Hello Christian.
As you pointed out - it is available through the REST api, and if you want to use the client API, we have a method to call it directly. For example:
var existingAssetTypes = mes.Asset.RESTGetJson<AssetType[]>($"api/Asset/Types?$filter=startswith(typeName, 'somePrefix')");
Comment actions -
Hi Ragnar
Thanks for the clarification. One follow-up question:
If I get the assets with mes.Assets.GetAssets(""); I will not get the AssetType (alyways null). -> See below.
What am I doing wrong? (in WATS I see all the needed data, but I am currently not able to read id through the API). Do I need another call to get the AssetType of an Asset?
Thanks!
Please sign in to leave a comment.
Comments
3 comments